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.
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.
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.
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.