BDBDatabase


Abstract

Wrapper for a DB instance

Discussion

Use instances of this class to load/store values



Methods

initWithFilename
open a database with the given file name, database name and configuration.
initWithFilename:databaseName:databaseConfig:
open a database with the given file name, database name and configuration.
close
deleteEntryWithTransaction
deleteEntryWithTransaction:key:
getEntryWithTransaction
retriev a value by its record number
getEntryWithTransaction:recordNumber:data:
retriev a value by its record number
openCursor
open and return a cursor used.
openCursor:cursorConfig:
open and return a cursor used.
putEntryWithTransaction
Stores an entry in the database.
putEntryWithTransaction:key:value:
Stores an entry in the database.
putDataWithTransaction:key:value:

close

- close;

Closes the database. After this call all settings related to the database are being invalidated. The previously hand-off configuration may be reused.


deleteEntryWithTransaction

See Also:
deleteEntryWithTransaction:key:
- ( BDBOperationStatus ) deleteEntryWithTransaction:
        (BDBTransaction *) transaction  key:
        (BDBDatabaseEntryData *) key;

In case of duplicate entries specified by the key all entries will be removed.

Parameter Descriptions
transaction
key
key specifying the entry to be deleted
method result
status which may equal BDB_STATUS_NOTFOUND, BDB_STATUS_KEYEMPTY or BDB_STATUS_SUCCESS

deleteEntryWithTransaction:key:

See Also:
deleteEntryWithTransaction
- ( BDBOperationStatus ) deleteEntryWithTransaction:
        (BDBTransaction *) transaction  key:
        (BDBDatabaseEntryData *) key;

In case of duplicate entries specified by the key all entries will be removed.

Parameter Descriptions
transaction
key
key specifying the entry to be deleted

getEntryWithTransaction

retriev a value by its record number
See Also:
getEntryWithTransaction:recordNumber:data:
- ( BDBOperationStatus ) getEntryWithTransaction:
        (BDBTransaction *) transaction  recordNumber:
        (BDBDatabaseRecordNumber *) recNo  data:
        (BDBDatabaseEntryData *) data;
Parameter Descriptions
transaction
underlying transaction. May equal nil
key
key to look for
data
entry to fill with the found data entry
method result
status of the operation

getEntryWithTransaction:recordNumber:data:

retriev a value by its record number
See Also:
getEntryWithTransaction
- ( BDBOperationStatus ) getEntryWithTransaction:
        (BDBTransaction *) transaction  recordNumber:
        (BDBDatabaseRecordNumber *) recNo  data:
        (BDBDatabaseEntryData *) data;
Parameter Descriptions
transaction
underlying transaction. May equal nil
key
key to look for
data
entry to fill with the found data entry

initWithFilename

open a database with the given file name, database name and configuration.
See Also:
initWithFilename:databaseName:databaseConfig:
+ ( BDBDatabase *) initWithFilename:
        (NSString *) fileName  databaseName:
        (NSString *) databaseName  databaseConfig:
        (BDBDatabaseConfig *) aDbConfig;

Depending on the configuration the database may be created if not existent. Also, the configuration determines the kind of database to use.

Parameter Descriptions
fileName
name of database file
databaseName
name of database. Useful if multiple databases will be used within a single file. May equal nil. If nil is given during creation then subsequent calls with values different from nil will be ignored.
aDbConfig
configuration parameters


initWithFilename:databaseName:databaseConfig:

open a database with the given file name, database name and configuration.
See Also:
initWithFilename
+ ( BDBDatabase *) initWithFilename:
        (NSString *) fileName  databaseName:
        (NSString *) databaseName  databaseConfig:
        (BDBDatabaseConfig *) aDbConfig;

Depending on the configuration the database may be created if not existent. Also, the configuration determines the kind of database to use.

Parameter Descriptions
fileName
name of database file
databaseName
name of database. Useful if multiple databases will be used within a single file. May equal nil. If nil is given during creation then subsequent calls with values different from nil will be ignored.
aDbConfig
configuration parameters


openCursor

open and return a cursor used.
See Also:
openCursor:cursorConfig:
- ( BDBCursor *) openCursor:
        (BDBTransaction *) transaction  cursorConfig:
        (BDBCursorConfig *) config;
Parameter Descriptions
transaction
underlying transaction. May be nil
config
settings for the cursor to be created ®result related cursor

openCursor:cursorConfig:

open and return a cursor used.
See Also:
openCursor
- ( BDBCursor *) openCursor:
        (BDBTransaction *) transaction  cursorConfig:
        (BDBCursorConfig *) config;
Parameter Descriptions
transaction
underlying transaction. May be nil
config
settings for the cursor to be created ®result related cursor

putDataWithTransaction:key:value:

- ( BDBOperationStatus ) putDataWithTransaction:
        (BDBTransaction *) transaction  key:
        (NSData *) key value:
        (NSData *) value;

Stores an entry in the database

Parameter Descriptions
key
may not be null. The handling of duplicates depends on the the configuration previously being set.
value
may not be null.

putEntryWithTransaction

Stores an entry in the database.
See Also:
putEntryWithTransaction:key:value:
- ( BDBOperationStatus ) putEntryWithTransaction:
        (BDBTransaction *) transaction  key:
        (BDBDatabaseEntryData *) key value:
        (BDBDatabaseEntryData *) value;
Parameter Descriptions
key
value for the key to be used. The handling of duplicates depends on the the configuration previously being set.
value
method result
status of operation

putEntryWithTransaction:key:value:

Stores an entry in the database.
See Also:
putEntryWithTransaction
- ( BDBOperationStatus ) putEntryWithTransaction:
        (BDBTransaction *) transaction  key:
        (BDBDatabaseEntryData *) key value:
        (BDBDatabaseEntryData *) value;
Parameter Descriptions
key
value for the key to be used. The handling of duplicates depends on the the configuration previously being set.
value

(Last Updated 2/4/2005)