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__);
34 DRM_TAPPS_EXCEPTION("DTappsDBOpen FAILED");
39 db_ret = DTappsDBBeginImmedTrans(__func__);
43 DRM_TAPPS_EXCEPTION("DTappsDBBeginImmedTrans FAILED");
48 IsBeginSuccessful = 1;
50 sql_query_table = DTappsGetSQLCreateTable(Table_Name);
52 if(sql_query_table == NULL)
54 DRM_TAPPS_EXCEPTION("DTappsGetSQLCreateTable FAILED");
59 DRM_TAPPS_FRQ_LOG("sql_query_table = %s", sql_query_table);
61 db_ret = DTappsExecuteSQL(pDb, sql_query_table);
65 DRM_TAPPS_EXCEPTION("DTappsGetSQLCreateTable FAILED");
70 db_ret = DTappsDBCommit(__func__);
74 DRM_TAPPS_EXCEPTION("DTappsDBCommit FAILED");
79 db_ret = DTappsDBClose(__func__);
83 DRM_TAPPS_EXCEPTION("DTappsDBClose FAILED");
88 DRM_TAPPS_FRQ_LOG("TAD DB created successfully");
94 if (1 == IsBeginSuccessful)
96 DTappsDBRollback(__func__);
99 db_ret = DTappsDBClose(__func__);
102 DRM_TAPPS_EXCEPTION("DTappsDBClose FAILED");
105 DRM_TAPPS_EXCEPTION("TAD DB creation FAILED");
110 int main(int, char *[])
112 DRM_TAPPS_FRQ_LOG("=============Start Create TAD DB file ================\n\n ");
114 if(0 != __drm_tad_create_db())
116 DRM_TAPPS_EXCEPTION("=============Error Creating TAD DB file ================\n\n ");
121 DRM_TAPPS_FRQ_LOG("=============Success Created TAD DB file ================\n\n ");