Package ru.curs.celesta.dbutils
Class Cursor
java.lang.Object
ru.curs.celesta.dbutils.CsqlBasicDataAccessor<CallContext>
ru.curs.celesta.dbutils.BasicDataAccessor
ru.curs.celesta.dbutils.BasicCursor
ru.curs.celesta.dbutils.Cursor
- All Implemented Interfaces:
Closeable,AutoCloseable,InFilterSupport
- Direct Known Subclasses:
CalllogCursor,GrainsCursor,HeaderCursor,LineCursor,LogCursor,LogsetupCursor,PermissionsCursor,RolesCursor,SequencesCursor,SessionlogCursor,TablesCursor,UserrolesCursor
Cursor class for data modification in tables.
-
Constructor Summary
ConstructorsConstructorDescriptionCursor(CallContext context) Cursor(CallContext context, ColumnMeta<?>... columns) -
Method Summary
Modifier and TypeMethodDescriptionfinal voidclear()Resets filters, sorting and fully cleans the buffer.static Cursorcreate(Table table, CallContext callContext) Creates a table specific cursor.static Cursorcreate(Table table, CallContext callContext, Set<String> fields) Creates a table specific cursor.final voiddelete()Deletes current record.final voidDeletes all records that were caught by current filter.final voidgetByValuesArray(Object... values) Performs a search of a record by key fields, throwing an exception if the record is not found.final Object[]Returns an array of field values of the primary key.getIn()final intgetMaxStrLen(String name) Deprecated.final intgetMaxStrLen(ColumnMeta<String> column) Returns maximal length of the text field .final intReturns version of the record.final CursorgetXRec()Returns a copy of the buffer containing values that were received by the last read from the database.final voidinit()Resets all fields of the buffer except for the key ones.final voidinsert()Performs cursor insert into the DB.final Tablemeta()Returns table description (meta information).setIn(BasicCursor otherCursor) final voidsetRecversion(int v) Sets version of the record.booleantryGetByValuesArray(Object... values) Tries to perform a search of a record by the key fields, returning a value whether the record was found or not.final booleanRetrieves a record from the database that corresponds to the fields of current primary key.final booleanTries to perform cursor insert into the DB.final booleanTries to perform an update of the cursor content in the DB.final voidupdate()Performs an update of the cursor content in the DB, throwing an exception in case if a record with such key fields is not found.Methods inherited from class ru.curs.celesta.dbutils.BasicCursor
asCSVLine, canDelete, canInsert, canModify, clearBuffer, copyFieldsFrom, copyFiltersFrom, copyOrderFrom, count, descOrders, findSet, first, getBufferCopy, getComplexFilter, getCurrentValues, getOrderBy, getValue, isEquivalent, last, limit, navigate, navigate, next, nextInSet, orderBy, orderBy, orderBy, orderByColumnNames, position, previous, reset, setComplexFilter, setFilter, setFilter, setRange, setRange, setRange, setRange, setRange, setRange, setValue, tryFindSet, tryFirst, tryLastMethods inherited from class ru.curs.celesta.dbutils.BasicDataAccessor
canReadMethods inherited from class ru.curs.celesta.dbutils.CsqlBasicDataAccessor
callContext, close, isClosed
-
Constructor Details
-
Cursor
-
Cursor
-
-
Method Details
-
create
Creates a table specific cursor.- Parameters:
table- Cursor related tablecallContext- Call context that is used for cursor creation- Returns:
-
create
Creates a table specific cursor.- Parameters:
table- Cursor related tablecallContext- Call context that is used for cursor creationfields- Fields the cursor should operate on- Returns:
-
insert
public final void insert()Performs cursor insert into the DB. -
tryInsert
public final boolean tryInsert()Tries to perform cursor insert into the DB.- Returns:
TRUEif inserted successfully, otherwise -FALSE.
-
update
public final void update()Performs an update of the cursor content in the DB, throwing an exception in case if a record with such key fields is not found. -
tryUpdate
public final boolean tryUpdate()Tries to perform an update of the cursor content in the DB.- Returns:
TRUEif updated successfully, otherwise -FALSE.
-
delete
public final void delete()Deletes current record. -
deleteAll
public final void deleteAll()Deletes all records that were caught by current filter. -
getByValuesArray
Performs a search of a record by key fields, throwing an exception if the record is not found.- Parameters:
values- values of the key fields
-
tryGetByValuesArray
Tries to perform a search of a record by the key fields, returning a value whether the record was found or not.- Parameters:
values- values of the key fields- Returns:
trueif the record is found, otherwise -false
-
tryGetCurrent
public final boolean tryGetCurrent()Retrieves a record from the database that corresponds to the fields of current primary key.- Returns:
trueif the record is retrieved, otherwise -false
-
setRecversion
public final void setRecversion(int v) Sets version of the record.- Parameters:
v- new version.
-
getRecversion
public final int getRecversion()Returns version of the record.- Returns:
-
getMaxStrLen
Deprecated.Returns maximal length of the text field (if it is defined).- Parameters:
name- name of the text field- Returns:
- length of the text field or -1 (minus one) if MAX is indicated instead of the length.
-
getMaxStrLen
Returns maximal length of the text field .- Parameters:
column- the text field- Returns:
- length of the text field or -1 (minus one) for TEXT fields.
-
init
public final void init()Resets all fields of the buffer except for the key ones. -
meta
Returns table description (meta information).- Specified by:
metain classBasicCursor- Returns:
-
clear
public final void clear()Description copied from class:BasicCursorResets filters, sorting and fully cleans the buffer.- Overrides:
clearin classBasicCursor
-
getXRec
Returns a copy of the buffer containing values that were received by the last read from the database.- Returns:
-
setIn
- Specified by:
setInin interfaceInFilterSupport
-
getIn
- Specified by:
getInin interfaceInFilterSupport
-
getCurrentKeyValues
Returns an array of field values of the primary key.- Returns:
-