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 
89 }ClDBTypeT;
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 
186 typedef ClDBRecordHandleT ClDBRecordT;
187 
192 typedef ClUint8T* ClDBKeyHandleT;
193 
198 typedef ClDBKeyHandleT ClDBKeyT;
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
269 clDbalOpen(CL_IN ClDBFileT dbFile,
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
312 clDbalClose(CL_IN ClDBHandleT dbHandle);
313 /*****************************************************************************/
314 
315 
357 ClRcT
358 clDbalSync(CL_IN ClDBHandleT dbHandle, ClUint32T flags);
359 /*****************************************************************************/
360 
361 
362 
401 ClRcT
402 clDbalRecordInsert(CL_IN ClDBHandleT dbHandle,
403  CL_IN ClDBKeyHandleT dbKey,
404  CL_IN ClUint32T keySize,
405  CL_IN ClDBRecordHandleT dbRec,
406  CL_IN ClUint32T recSize);
407 /*****************************************************************************/
408 
441 ClRcT
442 clDbalRecordReplace(CL_IN ClDBHandleT dbHandle,
443  CL_IN ClDBKeyHandleT dbKey,
444  CL_IN ClUint32T keySize,
445  CL_IN ClDBRecordHandleT dbRec,
446  CL_IN ClUint32T recSize);
447 /*****************************************************************************/
448 
484 ClRcT
485 clDbalRecordGet(CL_IN ClDBHandleT dbHandle,
486  CL_IN ClDBKeyHandleT dbKey,
487  CL_IN ClUint32T keySize,
488  CL_OUT ClDBRecordHandleT* pDBRec,
489  CL_OUT ClUint32T* pRecSize);
490 /*****************************************************************************/
491 
520 ClRcT
521 clDbalRecordDelete(CL_IN ClDBHandleT dbHandle,
522  CL_IN ClDBKeyHandleT dbKey,
523  CL_IN ClUint32T keySize);
524 /*****************************************************************************/
525 
568 ClRcT
569 clDbalFirstRecordGet(CL_IN ClDBHandleT dbHandle,
570  CL_OUT ClDBKeyHandleT* pDBKey,
571  CL_OUT ClUint32T* pKeySize,
572  CL_OUT ClDBRecordHandleT* pDBRec,
573  CL_OUT ClUint32T* pRecSize);
574 /*****************************************************************************/
575 
618 ClRcT
619 clDbalNextRecordGet(CL_IN ClDBHandleT dbHandle,
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
692 clDbalTxnOpen(CL_IN ClDBFileT dbFile,
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
731 clDbalTransactionBegin(CL_IN ClDBHandleT dbHandle);
732 /*****************************************************************************/
733 
766 ClRcT
767 clDbalTransactionCommit(CL_IN ClDBHandleT dbHandle);
768 /*****************************************************************************/
769 
802 ClRcT
803 clDbalTransactionAbort(CL_IN ClDBHandleT dbHandle);
804 /*****************************************************************************/
805 
836 ClRcT
837 clDbalRecordFree(CL_IN ClDBHandleT dbHandle,
838  CL_IN ClDBRecordHandleT dbRec);
839 /*****************************************************************************/
840 
871 ClRcT
872 clDbalKeyFree(CL_IN ClDBHandleT dbHandle,
873  CL_IN ClDBKeyHandleT dbKey);
874 /*****************************************************************************/
875 
876 #ifdef __cplusplus
877 }
878 #endif
879 
880 #endif /* _CL_DBAL_API_H_ */
881 
882 

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