Apache Portable Runtime
Data Structures | Macros | Typedefs | Functions

Data Structures

struct  apr_sdbm_datum_t
 

Macros

#define APR_SDBM_DIRFEXT   ".dir"
 
#define APR_SDBM_PAGFEXT   ".pag"
 
#define APR_SDBM_INSERT   0
 
#define APR_SDBM_REPLACE   1
 
#define APR_SDBM_INSERTDUP   2
 

Typedefs

typedef struct apr_sdbm_t apr_sdbm_t
 

Functions

apr_status_t apr_sdbm_open (apr_sdbm_t **db, const char *name, apr_int32_t mode, apr_fileperms_t perms, apr_pool_t *p)
 
apr_status_t apr_sdbm_close (apr_sdbm_t *db)
 
apr_status_t apr_sdbm_lock (apr_sdbm_t *db, int type)
 
apr_status_t apr_sdbm_unlock (apr_sdbm_t *db)
 
apr_status_t apr_sdbm_fetch (apr_sdbm_t *db, apr_sdbm_datum_t *value, apr_sdbm_datum_t key)
 
apr_status_t apr_sdbm_store (apr_sdbm_t *db, apr_sdbm_datum_t key, apr_sdbm_datum_t value, int opt)
 
apr_status_t apr_sdbm_delete (apr_sdbm_t *db, const apr_sdbm_datum_t key)
 
apr_status_t apr_sdbm_firstkey (apr_sdbm_t *db, apr_sdbm_datum_t *key)
 
apr_status_t apr_sdbm_nextkey (apr_sdbm_t *db, apr_sdbm_datum_t *key)
 
int apr_sdbm_rdonly (apr_sdbm_t *db)
 

Detailed Description

Macro Definition Documentation

#define APR_SDBM_DIRFEXT   ".dir"

SDBM Directory file extension

#define APR_SDBM_INSERT   0

Insert

#define APR_SDBM_INSERTDUP   2

Insert with duplicates

#define APR_SDBM_PAGFEXT   ".pag"

SDBM page file extension

#define APR_SDBM_REPLACE   1

Replace

Typedef Documentation

typedef struct apr_sdbm_t apr_sdbm_t

Structure for referencing an sdbm

Function Documentation

apr_status_t apr_sdbm_close ( apr_sdbm_t db)

Close an sdbm file previously opened by apr_sdbm_open

Parameters
dbThe database to close
apr_status_t apr_sdbm_delete ( apr_sdbm_t db,
const apr_sdbm_datum_t  key 
)

Delete an sdbm record value by key

Parameters
dbThe database
keyThe key datum of the record to delete
Remarks
It is not an error to delete a non-existent record.
apr_status_t apr_sdbm_fetch ( apr_sdbm_t db,
apr_sdbm_datum_t value,
apr_sdbm_datum_t  key 
)

Fetch an sdbm record value by key

Parameters
dbThe database
valueThe value datum retrieved for this record
keyThe key datum to find this record
apr_status_t apr_sdbm_firstkey ( apr_sdbm_t db,
apr_sdbm_datum_t key 
)

Retrieve the first record key from a dbm

Parameters
dbThe database
keyThe key datum of the first record
Remarks
The keys returned are not ordered. To traverse the list of keys for an sdbm opened with APR_FOPEN_SHARELOCK, the caller must use apr_sdbm_lock prior to retrieving the first record, and hold the lock until after the last call to apr_sdbm_nextkey.
apr_status_t apr_sdbm_lock ( apr_sdbm_t db,
int  type 
)

Lock an sdbm database for concurency of multiple operations

Parameters
dbThe database to lock
typeThe lock type
          APR_FLOCK_SHARED
          APR_FLOCK_EXCLUSIVE
Remarks
Calls to apr_sdbm_lock may be nested. All apr_sdbm functions perform implicit locking. Since an APR_FLOCK_SHARED lock cannot be portably promoted to an APR_FLOCK_EXCLUSIVE lock, apr_sdbm_store and apr_sdbm_delete calls will fail if an APR_FLOCK_SHARED lock is held. The apr_sdbm_lock call requires the database to be opened with the APR_FOPEN_SHARELOCK mode value.
apr_status_t apr_sdbm_nextkey ( apr_sdbm_t db,
apr_sdbm_datum_t key 
)

Retrieve the next record key from an sdbm

Parameters
dbThe database
keyThe key datum of the next record
apr_status_t apr_sdbm_open ( apr_sdbm_t **  db,
const char *  name,
apr_int32_t  mode,
apr_fileperms_t  perms,
apr_pool_t p 
)

Open an sdbm database by file name

Parameters
dbThe newly opened database
nameThe sdbm file to open
modeThe flag values (APR_FOPEN_READ and APR_FOPEN_BINARY flags are implicit)
          APR_FOPEN_WRITE      open for read-write access
          APR_FOPEN_CREATE     create the sdbm if it does not exist
          APR_FOPEN_TRUNCATE   empty the contents of the sdbm
          APR_FOPEN_EXCL       fail for APR_FOPEN_CREATE if the file exists
          APR_FOPEN_DELONCLOSE delete the sdbm when closed
          APR_FOPEN_SHARELOCK  support locking across process/machines
permsPermissions to apply to if created
pThe pool to use when creating the sdbm
Remarks
The sdbm name is not a true file name, as sdbm appends suffixes for seperate data and index files.
int apr_sdbm_rdonly ( apr_sdbm_t db)

Returns true if the sdbm database opened for read-only access

Parameters
dbThe database to test
apr_status_t apr_sdbm_store ( apr_sdbm_t db,
apr_sdbm_datum_t  key,
apr_sdbm_datum_t  value,
int  opt 
)

Store an sdbm record value by key

Parameters
dbThe database
keyThe key datum to store this record by
valueThe value datum to store in this record
optThe method used to store the record
          APR_SDBM_INSERT     return an error if the record exists
          APR_SDBM_REPLACE    overwrite any existing record for key
apr_status_t apr_sdbm_unlock ( apr_sdbm_t db)

Release an sdbm lock previously aquired by apr_sdbm_lock

Parameters
dbThe database to unlock