diff options
Diffstat (limited to 'src/notification_db.c')
-rwxr-xr-x | src/notification_db.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/notification_db.c b/src/notification_db.c index 98346d2..6450641 100755 --- a/src/notification_db.c +++ b/src/notification_db.c @@ -26,19 +26,25 @@ #include <sqlite3.h> #include <db-util.h> +#include <tizen.h> #include <notification_error.h> #include <notification_debug.h> #include <notification_db.h> -sqlite3 *notification_db_open(const char *dbfile) +sqlite3 * notification_db_open(const char *dbfile) { int ret = 0; - sqlite3 *db; + sqlite3 *db =0; ret = db_util_open(dbfile, &db, 0); if (ret != SQLITE_OK) { - NOTIFICATION_ERR("DB open error(%d), %s", ret, dbfile); + if (ret == SQLITE_PERM) { + set_last_result(NOTIFICATION_ERROR_PERMISSION_DENIED); + } + else { + set_last_result(NOTIFICATION_ERROR_FROM_DB); + } return NULL; } @@ -50,7 +56,7 @@ int notification_db_close(sqlite3 ** db) int ret = 0; if (db == NULL || *db == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = db_util_close(*db); @@ -70,10 +76,10 @@ int notification_db_exec(sqlite3 * db, const char *query, int *num_changes) sqlite3_stmt *stmt = NULL; if (db == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } if (query == NULL) { - return NOTIFICATION_ERROR_INVALID_DATA; + return NOTIFICATION_ERROR_INVALID_PARAMETER; } ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL); |