2 * Copyright (c) 2000-2015 Samsung Electronics Co., Ltd.
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
8 * http://floralicense.org/license/
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.
17 #include <drm-tizen-mid.h>
19 #include "DTapps2SqliteDB.h"
21 static int __drm_tad_create_db(void)
24 int IsBeginSuccessful = 0;
26 char Table_Name[16] = "dtapps2rights";
27 char *sql_query_table = NULL;
30 db_ret = DTappsDBOpen(pDb, __func__);
33 DRM_TAPPS_EXCEPTION("DTappsDBOpen FAILED");
37 db_ret = DTappsDBBeginImmedTrans(__func__);
40 DRM_TAPPS_EXCEPTION("DTappsDBBeginImmedTrans FAILED");
44 IsBeginSuccessful = 1;
46 sql_query_table = DTappsGetSQLCreateTable(Table_Name);
48 if (sql_query_table == NULL) {
49 DRM_TAPPS_EXCEPTION("DTappsGetSQLCreateTable FAILED");
53 DRM_TAPPS_FRQ_LOG("sql_query_table = %s", sql_query_table);
55 db_ret = DTappsExecuteSQL(pDb, sql_query_table);
58 DRM_TAPPS_EXCEPTION("DTappsGetSQLCreateTable FAILED");
62 db_ret = DTappsDBCommit(__func__);
65 DRM_TAPPS_EXCEPTION("DTappsDBCommit FAILED");
70 db_ret = DTappsDBClose(__func__);
73 DRM_TAPPS_EXCEPTION("DTappsDBClose FAILED");
77 DRM_TAPPS_FRQ_LOG("TAD DB created successfully");
83 if (1 == IsBeginSuccessful)
84 DTappsDBRollback(__func__);
86 db_ret = DTappsDBClose(__func__);
89 DRM_TAPPS_EXCEPTION("DTappsDBClose FAILED");
91 DRM_TAPPS_EXCEPTION("TAD DB creation FAILED");
96 int main(int, char *[])
98 DRM_TAPPS_FRQ_LOG("=========Start Create TAD DB file ============\n\n");
100 if (0 != __drm_tad_create_db()) {
101 DRM_TAPPS_EXCEPTION("=========Error Creating TAD DB file ============\n\n");
105 DRM_TAPPS_FRQ_LOG("=========Success Created TAD DB file ============\n\n");