Class | TokyoCabinet::BDBCUR |
In: |
tokyocabinet-doc.rb
|
Parent: | Object |
Cursor is a mechanism to access each record of B+ tree database in
ascending or descending order.
CPCURRENT | = | 0 | cursor put mode: current | |
CPBEFORE | = | 1 | cursor put mode: before | |
CPAFTER | = | 2 | cursor put mode: after |
Create a cursor object.
`bdb' specifies the B+ tree
database object.
The return value is the new cursor object.
Note that
the cursor is available only after initialization with the `first' or
the `jump' methods and so on. Moreover, the position of the cursor
will be indefinite when the database is updated after the initialization of
the cursor.
Move the cursor to the first record.
If successful, the return value is
true, else, it is false. False is returned if there is no record in the
database.
Move the cursor to the front of records corresponding a key.
`key' specifies the key.
If successful, the return value
is true, else, it is false. False is returned if there is no record
corresponding the condition.
The cursor is set to the first record
corresponding the key or the next substitute if completely matching record
does not exist.
Get the key of the record where the cursor is.
If successful, the return
value is the key, else, it is `nil'. ‘nil' is returned
when the cursor is at invalid position.
Move the cursor to the last record.
If successful, the return value is
true, else, it is false. False is returned if there is no record in the
database.
Move the cursor to the next record.
If successful, the return value is
true, else, it is false. False is returned if there is no next record.
Remove the record where the cursor is.
If successful, the return value is
true, else, it is false. False is returned when the cursor is at invalid
position.
After deletion, the cursor is moved to the next record if
possible.
Move the cursor to the previous record.
If successful, the return value
is true, else, it is false. False is returned if there is no previous
record.
Insert a record around the cursor.
`value' specifies the
value.
`cpmode' specifies detail adjustment:
`TokyoCabinet::BDBCUR::CPCURRENT', which means that the value of the
current record is overwritten, `TokyoCabinet::BDBCUR::CPBEFORE',
which means that the new record is inserted before the current record,
`TokyoCabinet::BDBCUR::CPAFTER', which means that the new record is
inserted after the current record.
If successful, the return value is
true, else, it is false. False is returned when the cursor is at invalid
position.
After insertion, the cursor is moved to the inserted record.