Synchronize with tizen 2.4
[platform/core/security/drm-service-core-tizen.git] / tappsd / inc / DTapps2SqliteDB.h
1 /*
2  * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.1 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 /**
18  * @file        DTapps2SqliteDB.h
19  * @brief       This file includes declarations and classes relating to DataBase.
20  */
21
22 #ifndef __DTAPPS_SQLITE_DB_H__
23 #define __DTAPPS_SQLITE_DB_H__
24
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28
29 #include "TADC_Core.h"
30 #include "drm_intf_tapps.h"
31
32 #define DTAPPS_SQL_FREE_TABLE sqlite3_free_table
33
34 typedef struct _tagTAPPSSqliteSelectTable{
35         sqlite3*        handle;
36         char**          result;
37         int             n_rows;
38         int             n_cols;
39 }TAPPSSqliteSelectTable;
40
41 /* Declarations for DB Wrappers */
42 BOOL DTappsDBOpen(void *&pDb,const char* CallingFun);
43 BOOL DTappsDBGet(void *& pDBConnection);
44 BOOL DTappsDBClose(const char* CallingFun);
45 BOOL DTappsDBBeginImmedTrans (const char* CallingFun);
46 BOOL DTappsDBCommit(const char* CallingFun);
47 BOOL DTappsDBRollback (const char* CallingFun);
48 BOOL DTappsExecuteSQL(void* pDB, const char* query);
49 BOOL DTappsSQLGetTable(void* pDB, const char* query, TAPPSSqliteSelectTable* select_table);
50 char* DTappsGetSQLCreateTable(const char* tableName);
51 void* DTappsStmtPrepare(void* pDB, const char* query);
52 int DTappsStmtBindParam (
53         void* pStmt,
54         unsigned int dIdx,
55         unsigned int Type,
56         void* pParam,
57         unsigned int dParamSize );
58 int DTappsStmtExecute (void* pStmt);
59 int DTappsStmtRelease (void* pStmt);
60 BOOL DTapps_DB_Install(const char* sql_query);
61 BOOL DTapps_Read_DB(const char* sql_query, TAPPSSqliteSelectTable* select_table);
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif /*__DTAPPS_SQLITE_DB_H__ */