Update notification_db_open 30/137930/2
authorMyungki Lee <mk5004.lee@samsung.com>
Mon, 10 Jul 2017 09:16:47 +0000 (18:16 +0900)
committerMyungki Lee <mk5004.lee@samsung.com>
Mon, 10 Jul 2017 09:21:36 +0000 (18:21 +0900)
- use sqlite3_open_v2 instead of db_util_open
  db_util_open has create option

Change-Id: I9d1fd772fc3c592a56e59c8a1d98237104219cee
Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
src/notification_db.c
src/notification_init.c

index c9ae095..4e12e2e 100755 (executable)
@@ -76,7 +76,13 @@ sqlite3 *notification_db_open(const char *dbfile)
        int ret = 0;
        sqlite3 *db = 0;
 
-       ret = db_util_open(dbfile, &db, 0);
+       ret = access(dbfile, R_OK | W_OK);
+       if (ret != 0) {
+               set_last_result(NOTIFICATION_ERROR_FROM_DB);
+               return NULL;
+       }
+
+       ret = sqlite3_open_v2(dbfile, &db, SQLITE_OPEN_READWRITE, NULL);
        if (ret != SQLITE_OK) {
                /* LCOV_EXCL_START */
                if (ret == SQLITE_PERM)
index 2120a9e..0a47979 100644 (file)
@@ -63,6 +63,7 @@ int main(int argc, char *argv[])
 
        if (argc > 2)
                uid = (uid_t)atoi(argv[2]);
+
        ret = notification_setting_refresh_setting_table(uid);
        if (ret != NOTIFICATION_ERROR_NONE) {
                _E("notification setting table refresh fail.");