OpenClovis Logo

clDbalApi.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2002-2012 OpenClovis Solutions Inc. All Rights Reserved.
3  *
4  * This file is available under a commercial license from the
5  * copyright holder or the GNU General Public License Version 2.0.
6  *
7  * The source code for this program is not published or otherwise
8  * divested of its trade secrets, irrespective of what has been
9  * deposited with the U.S. Copyright office.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * General Public License for more details.
15  *
16  * For more information, see the file COPYING provided with this
17  * material.
18  */
19 /*******************************************************************************
20  * ModuleName : dbal
21  * File : clDbalApi.h
22  *******************************************************************************/
23 
24 /*******************************************************************************
25  * Description :
26  * This file contains essential definitions for the Database Abstraction
27  * Layer.
28  *****************************************************************************/
29 
30 
31 /********************************************************************************/
32 /******************************** DBAL APIs ************************************/
33 /********************************************************************************/
34 /* */
35 /* clDbalOpen */
36 /* clDbalClose */
37 /* clDbalRecordInsert */
38 /* clDbalRecordReplace */
39 /* clDbalRecordGet */
40 /* clDbalRecordDelete */
41 /* clDbalFirstRecordGet */
42 /* clDbalNextRecordGet */
43 /* clDbalTransactionBegin */
44 /* clDbalTransactionCommit */
45 /* clDbalTransactionAbort */
46 /* clDbalRecordFree */
47 /* clDbalKeyFree */
48 /* */
49 /********************************************************************************/
50 
62 #ifndef _CL_DBAL_API_H_
63 #define _CL_DBAL_API_H_
64 
65 #ifdef __cplusplus
66 extern "C" {
67 #endif
68 
69 #include "clDbalErrors.h"
70 
71 /*******************************************************************************************/
72 
76 typedef enum ClDBType
77 {
86 
87  CL_DB_MAX_TYPE
88 
90 
91 typedef struct ClDbalBerkeleyConfigurationT {
92 
96 ClUint8T* engineEnvironmentPath;
97 
98 }ClDbalBerkeleyConfigurationT;
99 
100 typedef struct ClDbalSQLiteConfiguration {
101 
102  /* Path where the database files has to be stored. */
103  ClUint8T* enginePath;
104 } ClDbalSQLiteConfigurationT;
105 
106 typedef struct ClDbalConfigurationT {
107  ClUint32T engineType;
108  union database {
109  ClDbalBerkeleyConfigurationT berkeleyConfig;
110  ClDbalSQLiteConfigurationT sqliteConfig;
111  }Database;
112 }ClDbalConfigurationT;
113 
117 typedef ClPtrT ClDBEngineT;
118 
119 
120 /*******************************************************************************************/
121 
127 typedef ClUint8T ClDBFlagT;
128 
133 #define CL_DB_CREAT 0X1
134 
139 #define CL_DB_OPEN 0x2
140 
145 #define CL_DB_APPEND 0x4
146 
156 #define CL_DB_SYNC 0x8
157 
158 #define CL_DB_MAX_FLAG 0x10
159 
163 typedef const char* ClDBNameT;
164 
168 typedef const char* ClDBFileT;
169 
174 typedef ClPtrT ClDBHandleT;
175 
180 typedef ClUint8T* ClDBRecordHandleT;
181 
187 
192 typedef ClUint8T* ClDBKeyHandleT;
193 
199 
200 
201 /****************************************************************************
202  * Database Maintenance APIs
203  * These APIs are responsible for housekeeping of the repository.
204  * Their functionalities include creating, opening, and closing a database and
205  * performing insert, get, delete, replace, etc operations on the databse.
206  ***************************************************************************/
207 
208 
209 /*****************************************************************************/
210 
268 ClRcT
270  CL_IN ClDBNameT dbName,
271  CL_IN ClDBFlagT dbFlag,
272  CL_IN ClUint32T maxKeySize,
273  CL_IN ClUint32T maxRecordSize,
274  CL_OUT ClDBHandleT* pDBHandle);
275 
276 /*****************************************************************************/
277 
311 ClRcT
313 /*****************************************************************************/
314 
315 
357 ClRcT
358 clDbalSync(CL_IN ClDBHandleT dbHandle, ClUint32T flags);
359 /*****************************************************************************/
360 
361 
362 
401 ClRcT
403  CL_IN ClDBKeyHandleT dbKey,
404  CL_IN ClUint32T keySize,
405  CL_IN ClDBRecordHandleT dbRec,
406  CL_IN ClUint32T recSize);
407 /*****************************************************************************/
408 
441 ClRcT
443  CL_IN ClDBKeyHandleT dbKey,
444  CL_IN ClUint32T keySize,
445  CL_IN ClDBRecordHandleT dbRec,
446  CL_IN ClUint32T recSize);
447 /*****************************************************************************/
448 
484 ClRcT
486  CL_IN ClDBKeyHandleT dbKey,
487  CL_IN ClUint32T keySize,
488  CL_OUT ClDBRecordHandleT* pDBRec,
489  CL_OUT ClUint32T* pRecSize);
490 /*****************************************************************************/
491 
520 ClRcT
522  CL_IN ClDBKeyHandleT dbKey,
523  CL_IN ClUint32T keySize);
524 /*****************************************************************************/
525 
568 ClRcT
570  CL_OUT ClDBKeyHandleT* pDBKey,
571  CL_OUT ClUint32T* pKeySize,
572  CL_OUT ClDBRecordHandleT* pDBRec,
573  CL_OUT ClUint32T* pRecSize);
574 /*****************************************************************************/
575 
618 ClRcT
620  CL_IN ClDBKeyHandleT currentKey,
621  CL_IN ClUint32T currentKeySize,
622  CL_OUT ClDBKeyHandleT* pDBNextKey,
623  CL_OUT ClUint32T* pNextKeySize,
624  CL_OUT ClDBRecordHandleT* pDBNextRec,
625  CL_OUT ClUint32T* pNextRecSize);
626 /*****************************************************************************/
627 
628 
691 ClRcT
693  CL_IN ClDBNameT dbName,
694  CL_IN ClDBFlagT dbFlag,
695  CL_IN ClUint32T maxKeySize,
696  CL_IN ClUint32T maxRecordSize,
697  CL_OUT ClDBHandleT* pDBHandle);
698 
730 ClRcT
732 /*****************************************************************************/
733 
766 ClRcT
768 /*****************************************************************************/
769 
802 ClRcT
804 /*****************************************************************************/
805 
836 ClRcT
838  CL_IN ClDBRecordHandleT dbRec);
839 /*****************************************************************************/
840 
871 ClRcT
873  CL_IN ClDBKeyHandleT dbKey);
874 /*****************************************************************************/
875 
876 #ifdef __cplusplus
877 }
878 #endif
879 
880 #endif /* _CL_DBAL_API_H_ */
881 
882 
Header file of Error Codes returned by the DBAL Library.
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
#define CL_OUT
CL_OUT macro assists in clearly defining arguments of an API, but has no actual meaning.
Definition: clCommon.h:110
#define CL_IN
CL_IN macro assists in clearly defining arguments of an API, but has no actual meaning.
Definition: clCommon.h:106
ClUint8T ClDBFlagT
Definition of database open flag type.
Definition: clDbalApi.h:127
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.
ClPtrT ClDBHandleT
Database Handle.
Definition: clDbalApi.h:174
ClDBType
Definition of Database type.
Definition: clDbalApi.h:77
ClRcT clDbalTransactionBegin(CL_IN ClDBHandleT dbHandle)
Begins the transaction on 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 clDbalClose(CL_IN ClDBHandleT dbHandle)
Closes a database instance.
const char * ClDBNameT
Type of the name of database.
Definition: clDbalApi.h:163
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 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.
ClRcT clDbalKeyFree(CL_IN ClDBHandleT dbHandle, CL_IN ClDBKeyHandleT dbKey)
Frees the database key.
enum ClDBType ClDBTypeT
Definition of Database type.
ClDBKeyHandleT ClDBKeyT
Deprecated DB Key Handle type.
Definition: clDbalApi.h:198
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 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 clDbalRecordFree(CL_IN ClDBHandleT dbHandle, CL_IN ClDBRecordHandleT dbRec)
Frees the database record.
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...
Definition: clDbalApi.h:192
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.
ClPtrT ClDBEngineT
Engine Handle.
Definition: clDbalApi.h:117
ClRcT clDbalTransactionCommit(CL_IN ClDBHandleT dbHandle)
Commits the transaction on a database instance.
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 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.
const char * ClDBFileT
Type of the DB File name.
Definition: clDbalApi.h:168
ClUint8T * ClDBRecordHandleT
Type of DB Record Handle (handle to the record which is to be inserted in DB or to be fetched from th...
Definition: clDbalApi.h:180
ClDBRecordHandleT ClDBRecordT
Deprecated DB Record Handle type.
Definition: clDbalApi.h:186
@ CL_DB_TYPE_BTREE
B-tree.
Definition: clDbalApi.h:85
@ CL_DB_TYPE_HASH
Hash table.
Definition: clDbalApi.h:81

Generated on Tue Jan 10 10:29:15 PST 2012 for OpenClovis SDK using Doxygen