diff options
author | Myungki Lee <mk5004.lee@samsung.com> | 2016-09-22 18:11:20 +0900 |
---|---|---|
committer | MyungKi Lee <mk5004.lee@samsung.com> | 2016-09-22 21:18:29 -0700 |
commit | d1e95562738dd0de7886ddf3ea7d2e3460537556 (patch) | |
tree | 2713f52c98a875746d55fcddf1164baf7514b072 | |
parent | d847736f8a092d4bd1acae1b049e71c313406066 (diff) | |
download | notification-d1e95562738dd0de7886ddf3ea7d2e3460537556.tar.gz notification-d1e95562738dd0de7886ddf3ea7d2e3460537556.tar.bz2 notification-d1e95562738dd0de7886ddf3ea7d2e3460537556.zip |
Add logic to init a dnd_allow_exception db
Change-Id: I0f17989634dc898b62dbe909c80594949765721e
Signed-off-by: Myungki Lee <mk5004.lee@samsung.com>
-rwxr-xr-x | src/notification_setting.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/notification_setting.c b/src/notification_setting.c index b945249..eb55c67 100755 --- a/src/notification_setting.c +++ b/src/notification_setting.c @@ -995,6 +995,8 @@ EXPORT_API int notification_system_setting_init_system_setting_table(uid_t uid) NOTIFICATION_DBG("Notification system setting table is already initialized."); } else { NOTIFICATION_DBG("Notification system setting table is not initialized yet"); + + /* notification_system_setting */ sqlite3_ret = sqlite3_prepare_v2(db, "INSERT INTO notification_system_setting (uid) VALUES (?) ", -1, &db_statement, NULL); if (sqlite3_ret != SQLITE_OK) { NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlite3_ret, sqlite3_errmsg(db)); @@ -1002,7 +1004,24 @@ EXPORT_API int notification_system_setting_init_system_setting_table(uid_t uid) goto out; } - sqlite3_bind_int(db_statement, field_index++, uid); + sqlite3_bind_int(db_statement, field_index, uid); + + sqlite3_ret = sqlite3_step(db_statement); + if (sqlite3_ret != SQLITE_OK && sqlite3_ret != SQLITE_DONE) { + NOTIFICATION_ERR("sqlite3_step failed [%d][%s]", sqlite3_ret, sqlite3_errmsg(db)); + err = NOTIFICATION_ERROR_FROM_DB; + goto out; + } + + /* dnd_allow_exception */ + sqlite3_ret = sqlite3_prepare_v2(db, "INSERT INTO dnd_allow_exception (uid) VALUES (?) ", -1, &db_statement, NULL); + if (sqlite3_ret != SQLITE_OK) { + NOTIFICATION_ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlite3_ret, sqlite3_errmsg(db)); + err = NOTIFICATION_ERROR_FROM_DB; + goto out; + } + + sqlite3_bind_int(db_statement, field_index, uid); sqlite3_ret = sqlite3_step(db_statement); if (sqlite3_ret != SQLITE_OK && sqlite3_ret != SQLITE_DONE) { |