Defines, Structures, Typedefs, Functions. More...
Files | |
file | clDbalApi.h |
Header file of DBAL related Definitions and APIs. | |
file | clDbalCfg.h |
Header file of DBAL Component Configuration APIs. | |
file | clDbalErrors.h |
Header file of Error Codes returned by the DBAL Library. |
Macros | |
#define | CL_DB_APPEND 0x4 |
This DB flag is used for opening a DB in APPEND mode. | |
#define | CL_DB_CREAT 0X1 |
This DB flag is used for creating a DB. | |
#define | CL_DB_OPEN 0x2 |
This DB flag is used for opening an existing DB. | |
#define | CL_DB_SYNC 0x8 |
One of the three DB open modes (CL_DB_CREAT, CL_DB_OPEN, CL_DB_APPEND) may be OR-ed with DB sync flag. | |
#define | CL_DBAL_ERR_ABORT_FAILED 0x102 |
An error has occured during transaction abort. | |
#define | CL_DBAL_ERR_COMMIT_FAILED 0x101 |
An error has occured during transaction commit. | |
#define | CL_DBAL_ERR_DB_ERROR 0x100 |
An unextected error has occured during DB operation. | |
#define | CL_DBAL_RC(ERROR_CODE) CL_RC(CL_CID_DBAL, (ERROR_CODE)) |
Appends the DBAL Component ID to the Error Code. |
Typedefs | |
typedef ClPtrT | ClDBEngineT |
Engine Handle. | |
typedef const char * | ClDBFileT |
Type of the DB File name. | |
typedef ClUint8T | ClDBFlagT |
Definition of database open flag type. | |
typedef ClPtrT | ClDBHandleT |
Database Handle. | |
typedef ClUint8T * | ClDBKeyHandleT |
Type of DB Key Handle (handle to the key of the record which is to be inserted in DB or to be fetched from the DB). | |
typedef ClDBKeyHandleT | ClDBKeyT |
Deprecated DB Key Handle type. | |
typedef const char * | ClDBNameT |
Type of the name of database. | |
typedef ClUint8T * | ClDBRecordHandleT |
Type of DB Record Handle (handle to the record which is to be inserted in DB or to be fetched from the DB). | |
typedef ClDBRecordHandleT | ClDBRecordT |
Deprecated DB Record Handle type. | |
typedef enum ClDBType | ClDBTypeT |
Definition of Database type. |
Enumerations | |
enum | ClDBType { CL_DB_TYPE_HASH = 0, CL_DB_TYPE_BTREE } |
Definition of Database type. More... |
Functions | |
ClRcT | clDbalClose (CL_IN ClDBHandleT dbHandle) |
Closes a database instance. | |
ClRcT | clDbalFirstRecordGet (CL_IN ClDBHandleT dbHandle, CL_OUT ClDBKeyHandleT *pDBKey, CL_OUT ClUint32T *pKeySize, CL_OUT ClDBRecordHandleT *pDBRec, CL_OUT ClUint32T *pRecSize) |
Returns the first key and associated record from a database instance. | |
ClRcT | clDbalKeyFree (CL_IN ClDBHandleT dbHandle, CL_IN ClDBKeyHandleT dbKey) |
Frees the database key. | |
ClRcT | clDbalLibFinalize (void) |
DBAL configuration module exit-point. | |
ClRcT | clDbalLibInitialize (void) |
DBAL configuration module entry-point. | |
ClRcT | clDbalNextRecordGet (CL_IN ClDBHandleT dbHandle, CL_IN ClDBKeyHandleT currentKey, CL_IN ClUint32T currentKeySize, CL_OUT ClDBKeyHandleT *pDBNextKey, CL_OUT ClUint32T *pNextKeySize, CL_OUT ClDBRecordHandleT *pDBNextRec, CL_OUT ClUint32T *pNextRecSize) |
Returns the next key and associated record from a database instance. | |
ClRcT | clDbalOpen (CL_IN ClDBFileT dbFile, CL_IN ClDBNameT dbName, CL_IN ClDBFlagT dbFlag, CL_IN ClUint32T maxKeySize, CL_IN ClUint32T maxRecordSize, CL_OUT ClDBHandleT *pDBHandle) |
Opens a database instance. | |
ClRcT | clDbalRecordDelete (CL_IN ClDBHandleT dbHandle, CL_IN ClDBKeyHandleT dbKey, CL_IN ClUint32T keySize) |
Deletes a record from a database instance. | |
ClRcT | clDbalRecordFree (CL_IN ClDBHandleT dbHandle, CL_IN ClDBRecordHandleT dbRec) |
Frees the database record. | |
ClRcT | clDbalRecordGet (CL_IN ClDBHandleT dbHandle, CL_IN ClDBKeyHandleT dbKey, CL_IN ClUint32T keySize, CL_OUT ClDBRecordHandleT *pDBRec, CL_OUT ClUint32T *pRecSize) |
Retrieves a record from a database instance. | |
ClRcT | clDbalRecordInsert (CL_IN ClDBHandleT dbHandle, CL_IN ClDBKeyHandleT dbKey, CL_IN ClUint32T keySize, CL_IN ClDBRecordHandleT dbRec, CL_IN ClUint32T recSize) |
Record Operation APIs. | |
ClRcT | clDbalRecordReplace (CL_IN ClDBHandleT dbHandle, CL_IN ClDBKeyHandleT dbKey, CL_IN ClUint32T keySize, CL_IN ClDBRecordHandleT dbRec, CL_IN ClUint32T recSize) |
Replaces a record in a database instance. | |
ClRcT | clDbalSync (CL_IN ClDBHandleT dbHandle, ClUint32T flags) |
Flushes (synchronizes) the DB modifications stored in the in-memory cache to disk. | |
ClRcT | clDbalTransactionAbort (CL_IN ClDBHandleT dbHandle) |
Aborts a transaction on a database instance. | |
ClRcT | clDbalTransactionBegin (CL_IN ClDBHandleT dbHandle) |
Begins the transaction on a database instance. | |
ClRcT | clDbalTransactionCommit (CL_IN ClDBHandleT dbHandle) |
Commits the transaction on a database instance. | |
ClRcT | clDbalTxnOpen (CL_IN ClDBFileT dbFile, CL_IN ClDBNameT dbName, CL_IN ClDBFlagT dbFlag, CL_IN ClUint32T maxKeySize, CL_IN ClUint32T maxRecordSize, CL_OUT ClDBHandleT *pDBHandle) |
Transaction Related APIs. |
Defines, Structures, Typedefs, Functions.
#define CL_DB_APPEND 0x4 |
This DB flag is used for opening a DB in APPEND mode.
Data inserted to the DB would be appended to the existing DB (if there is any).
#define CL_DB_CREAT 0X1 |
This DB flag is used for creating a DB.
If the DB already exists then it is removed and a new DB is be created.
#define CL_DB_OPEN 0x2 |
This DB flag is used for opening an existing DB.
If the DB doesn't exist already then an error is returned.
#define CL_DB_SYNC 0x8 |
One of the three DB open modes (CL_DB_CREAT, CL_DB_OPEN, CL_DB_APPEND) may be OR-ed with DB sync flag.
When specified, the underlying DB engine will automatically synchronize all database operations to the disk. Note : Currently this flag is supported only with GDBM and SQLite and it has no effect in case of other DB types. Please use clDbalSync() with other DBs to synchronize DB operations to the disk.
typedef ClUint8T ClDBFlagT |
Definition of database open flag type.
Database can be opened in following three modes : Create, Open, Append.
typedef ClPtrT ClDBHandleT |
Database Handle.
The handle uniquely identifies the created/opened database instance.
typedef ClDBKeyHandleT ClDBKeyT |
Deprecated DB Key Handle type.
ClDBKeyHandleT should be used in place of ClDBKeyT.
typedef ClDBRecordHandleT ClDBRecordT |
Deprecated DB Record Handle type.
ClDBRecordHandleT should be used in place of ClDBRecordT.
enum ClDBType |
ClRcT clDbalClose | ( | CL_IN ClDBHandleT | dbHandle | ) |
Closes a database instance.
dbHandle | Handle of the Database instance to be closed. This is the handle that was returned to the user when clDbalOpen() call was successfully executed. All Db operations if performed using this DB handle after successful clDbalClose() are invalid and returned with an error. |
CL_OK | The API executed successfully. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
ClRcT clDbalFirstRecordGet | ( | CL_IN ClDBHandleT | dbHandle, |
CL_OUT ClDBKeyHandleT * | pDBKey, | ||
CL_OUT ClUint32T * | pKeySize, | ||
CL_OUT ClDBRecordHandleT * | pDBRec, | ||
CL_OUT ClUint32T * | pRecSize | ||
) |
Returns the first key and associated record from a database instance.
dbHandle | Handle to the Database from where the object is being deleted. This is the handle that was returned to the user when clDbalOpen() call was successfully executed. |
pDBKey | (out) Pointer to key handle, in which the first record's key is returned. Memory allocation is done by DBAL but you must free this memory using clDbalKeyFree() API. |
pKeySize | (out) Pointer to variable in which size of the key is being returned. |
pDBRec | (out) Pointer to record handle in which the first record is returned. Memory allocation is done by DBAL but you must free this memory using clDbalRecordFree() API. |
pRecSize | (out) Pointer to variable in which size of the record is being returned. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
CL_DBAL_ERR_DB_ERROR | If the underlying database fails. |
CL_ERR_NOT_EXIST | If the first record does not exist. |
ClRcT clDbalKeyFree | ( | CL_IN ClDBHandleT | dbHandle, |
CL_IN ClDBKeyHandleT | dbKey | ||
) |
Frees the database key.
dbHandle | Handle to the Database. This is the handle that was returned to the user when clDbalOpen() call was successfully executed. |
dbKey | Key to be freed. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
ClRcT clDbalLibFinalize | ( | void | ) |
DBAL configuration module exit-point.
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | If the lib is not intialized before calling this function. |
ClRcT clDbalLibInitialize | ( | void | ) |
DBAL configuration module entry-point.
CL_OK | The API executed successfully. |
CL_ERR_NO_MEMORY | On memory allocation failure. |
ClRcT clDbalNextRecordGet | ( | CL_IN ClDBHandleT | dbHandle, |
CL_IN ClDBKeyHandleT | currentKey, | ||
CL_IN ClUint32T | currentKeySize, | ||
CL_OUT ClDBKeyHandleT * | pDBNextKey, | ||
CL_OUT ClUint32T * | pNextKeySize, | ||
CL_OUT ClDBRecordHandleT * | pDBNextRec, | ||
CL_OUT ClUint32T * | pNextRecSize | ||
) |
Returns the next key and associated record from a database instance.
dbHandle | Handle to the Database from which the next record is being retrieved. This is the handle that was returned to the user when clDbalOpen() call was successfully executed. |
currentKey | Current record's key handle. |
currentKeySize | Size of the current key. |
pDBNextKey | (out) Pointer to key handle, in which the next record's key is being returned. Memory allocation is done by DBAL but you must free this memory using clDbalKeyFree() API. |
pNextKeySize | (out) Pointer to variable in which size of the key is being returned. |
pDBNextRec | (out) Pointer to record handle, in which handle of the next record is returned. Memory allocation is done by DBAL but you must free this memory using clDbalRecordFree() API. |
pNextRecSize | (out) Pointer to variable in which size of the record is being returned. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
CL_DBAL_ERR_DB_ERROR | If the underlying database fails. |
CL_ERR_NOT_EXIST | If the key does not exist. |
ClRcT clDbalOpen | ( | CL_IN ClDBFileT | dbFile, |
CL_IN ClDBNameT | dbName, | ||
CL_IN ClDBFlagT | dbFlag, | ||
CL_IN ClUint32T | maxKeySize, | ||
CL_IN ClUint32T | maxRecordSize, | ||
CL_OUT ClDBHandleT * | pDBHandle | ||
) |
Opens a database instance.
dbFile | This parameter specifies the file name along with its path, where the database is to be created. If this parameter is NULL and the database is Berkeley Database, then an in-memory database is created. This parameter is ignored if the database is other than Berkeley Database. |
dbName | This parameter specifies the database name along with its path, where the database is to be created. The records are stored in the database of this name. This parameter is used in case of both Berkeley and GDBM Database. |
dbFlag | This flag accepts following three values:
|
maxKeySize | Maximum size of the key (in bytes) to be stored in the database. This parameter is ignored in case of Berkeley and GDBM databases. |
maxRecordSize | Maximum size of the record (in bytes) to be stored in the database. This parameter is ignored in case of Berkeley and GDBM databases. |
pDBHandle | (out)Pointer to variable of type ClDBHandleT in which the newly created database handle is returned. This handle should be used for all the subsequent operations on this database instance. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_PARAMETER | On passing invalid parameters. |
CL_ERR_NO_MEMORY | On memory allocation failure. |
CL_DBAL_ERR_DB_ERROR | If the underlying database fails. |
ClRcT clDbalRecordDelete | ( | CL_IN ClDBHandleT | dbHandle, |
CL_IN ClDBKeyHandleT | dbKey, | ||
CL_IN ClUint32T | keySize | ||
) |
Deletes a record from a database instance.
dbHandle | Handle to the Database from which the record is being deleted. |
dbKey | Key handle of the record. |
keySize | Size of the key. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_HANDLE | on passing an invalid handle. |
CL_DBAL_ERR_DB_ERROR | If the underlying database fails. |
CL_ERR_NOT_EXIST | If the key does not exist. |
ClRcT clDbalRecordFree | ( | CL_IN ClDBHandleT | dbHandle, |
CL_IN ClDBRecordHandleT | dbRec | ||
) |
Frees the database record.
dbHandle | Handle to the Database. This is the handle that was returned to the user when clDbalOpen() call was successfully executed. |
dbRec | Record to be freed. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
ClRcT clDbalRecordGet | ( | CL_IN ClDBHandleT | dbHandle, |
CL_IN ClDBKeyHandleT | dbKey, | ||
CL_IN ClUint32T | keySize, | ||
CL_OUT ClDBRecordHandleT * | pDBRec, | ||
CL_OUT ClUint32T * | pRecSize | ||
) |
Retrieves a record from a database instance.
dbHandle | Handle to the Database from which the record is being retrieved. This is the handle that was returned to the user when clDbalOpen() call was successfully executed. |
dbKey | Key handle, whose associated record is being retrieved. |
keySize | Size of the key. |
pDBRec | (out) Pointer to record handle, in which the record is being returned. Memory allocation is done by DBAL but you must free this memory using clDbalRecordFree() API. |
pRecSize | (out) Pointer to variable in which size of the record is being returned. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
CL_DBAL_ERR_DB_ERROR | If the underlying database fails. |
CL_ERR_NOT_EXIST | If the key does not exist. |
ClRcT clDbalRecordInsert | ( | CL_IN ClDBHandleT | dbHandle, |
CL_IN ClDBKeyHandleT | dbKey, | ||
CL_IN ClUint32T | keySize, | ||
CL_IN ClDBRecordHandleT | dbRec, | ||
CL_IN ClUint32T | recSize | ||
) |
Record Operation APIs.
Adds a record into a database instance.
dbHandle | Handle to the Database into which the record is being added. This is the handle that was returned to the user when clDbalOpen() call was successfully executed. |
dbKey | Record's key handle. In case of GDBM the key must be a string. |
keySize | Size of the key. |
dbRec | Record handle. In case of GDBM, the record must be a string. |
recSize | Size of the record. |
CL_OK | The API executed successfully. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
CL_ERR_DUPLICATE | If an already existing key is added. |
CL_DBAL_ERR_DB_ERROR | If the underlying database fails. |
ClRcT clDbalRecordReplace | ( | CL_IN ClDBHandleT | dbHandle, |
CL_IN ClDBKeyHandleT | dbKey, | ||
CL_IN ClUint32T | keySize, | ||
CL_IN ClDBRecordHandleT | dbRec, | ||
CL_IN ClUint32T | recSize | ||
) |
Replaces a record in a database instance.
dbHandle | Handle to the Database into which the record is being added. This is the handle that was returned to the user when clDbalOpen() call was successfully executed. |
dbKey | Record's key handle. |
keySize | Size of the key. |
dbRec | Record handle. |
recSize | Size of the record. |
CL_OK | The API executed successfully. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
CL_DBAL_ERR_DB_ERROR | If the underlying database fails. |
ClRcT clDbalSync | ( | CL_IN ClDBHandleT | dbHandle, |
ClUint32T | flags | ||
) |
Flushes (synchronizes) the DB modifications stored in the in-memory cache to disk.
dbHandle | Handle of the Database instance to be synchronized. This is the handle that was returned to the user when clDbalOpen() call was successfully executed. |
flags | The flags parameter is currently unused, and must be set to 0. |
CL_OK | The API executed successfully. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
CL_ERR_INVALID_PARAMETER | On passing invalid parameters (flags). |
CL_DBAL_ERR_DB_ERROR | If the underlying database fails. |
ClRcT clDbalTransactionAbort | ( | CL_IN ClDBHandleT | dbHandle | ) |
Aborts a transaction on a database instance.
dbHandle | Handle to the Database in which the transaction is being aborted. This is the handle that was returned to the user when clDbalTxnOpen() call was successfully executed. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
CL_DBAL_ERR_ABORT_FAILED | If the abort of underlying database fails. |
CL_ERR_NOT_SUPPORTED | If the underlying database does not support transactions. |
ClRcT clDbalTransactionBegin | ( | CL_IN ClDBHandleT | dbHandle | ) |
Begins the transaction on a database instance.
dbHandle | Handle to the Database in which the transaction is to be started. This is the handle that was returned to the user when clDbalTxnOpen() call was successfully executed. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
CL_ERR_NOT_SUPPORTED | If the underlying database does not support transactions. |
ClRcT clDbalTransactionCommit | ( | CL_IN ClDBHandleT | dbHandle | ) |
Commits the transaction on a database instance.
dbHandle | Handle to the Database in which the transaction is being commited. This is the handle that was returned to the user when clDbalTxnOpen() call was successfully executed. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_HANDLE | On passing an invalid handle. |
CL_DBAL_ERR_COMMIT_FAILED | If the commit of underlying database fails. |
CL_ERR_NOT_SUPPORTED | If the underlying database does not support transactions. |
ClRcT clDbalTxnOpen | ( | CL_IN ClDBFileT | dbFile, |
CL_IN ClDBNameT | dbName, | ||
CL_IN ClDBFlagT | dbFlag, | ||
CL_IN ClUint32T | maxKeySize, | ||
CL_IN ClUint32T | maxRecordSize, | ||
CL_OUT ClDBHandleT * | pDBHandle | ||
) |
Transaction Related APIs.
Opens a database instance with transaction support.
dbFile | This parameter specifies the file name along with its path, where the database is to be created. If this parameter is NULL and the database is Berkeley Database, then an in-memory database is created. This parameter is ignored if the database is other than Berkeley Database. |
dbName | This parameter specifies the database name along with its path, where the database is to be created. The records are stored in the database of this name. This parameter is used in case of both Berkeley and GDBM Database. |
dbFlag | This flag accepts following three values:
|
maxKeySize | Maximum size of the key (in bytes) to be stored in the database. This parameter is ignored in case of Berkeley and GDBM databases. |
maxRecordSize | Maximum size of the record (in bytes) to be stored in the database. This parameter is ignored in case of Berkeley and GDBM databases. |
pDBHandle | (out)Pointer to variable of type ClDBHandleT in which the newly created database handle is returned. This handle should be used for all the subsequent operations on this database instance. |
CL_OK | The API executed successfully. |
CL_ERR_NULL_POINTER | On passing a NULL pointer. |
CL_ERR_INVALID_PARAMETER | On passing invalid parameters. |
CL_ERR_NO_MEMORY | On memory allocation failure. |
CL_DBAL_ERR_DB_ERROR | If the underlying database fails. |
CL_ERR_NOT_SUPPORTED | If the underlying database does not support transactions. |