Add function to init data 48/165448/2
authorSeungha Son <seungha.son@samsung.com>
Fri, 29 Dec 2017 03:02:49 +0000 (12:02 +0900)
committerSeungha Son <seungha.son@samsung.com>
Fri, 29 Dec 2017 04:45:45 +0000 (13:45 +0900)
Signed-off-by: Seungha Son <seungha.son@samsung.com>
Change-Id: I5f0c9c3275467fb81503945714104519e3e3b461

include/notification_noti.h
src/notification_noti.c

index fd0d662713b97db53904f64566f38e685a4466f0..a12eb861b4b5ad23f95e8c99d305843a3cc32c11 100644 (file)
@@ -71,5 +71,7 @@ int notification_noti_add_template(notification_h noti, char *template_name);
 int notification_noti_get_package_template(notification_h noti, char *app_id, char *template_name);
 int notification_noti_delete_template(const char *pkg_id);
 
+void notification_noti_init_data(void);
+
 #endif /* __NOTIFICATION_NOTI_H__ */
 
index 4a54b939801ae19a413a3be73aae5968d53f709e..1c8a6ed9f37c1c98fdb319236c47cd280a7d3493 100755 (executable)
@@ -2013,3 +2013,31 @@ err:
 
        return ret;
 }
+
+EXPORT_API void notification_noti_init_data(void)
+{
+       int ret;
+       sqlite3 *db = NULL;
+       char *query = NULL;
+
+       db = notification_db_open();
+       if (!db) {
+               ERR("db open");
+               return;
+       }
+
+       query = sqlite3_mprintf("DELETE FROM noti_list WHERE type = %d OR flags_for_property & %d",
+                       NOTIFICATION_TYPE_ONGOING, NOTIFICATION_PROP_VOLATILE_DISPLAY);
+       if (!query) {
+               ERR("OOM - sql query");
+               notification_db_close(&db);
+               return;
+       }
+
+       ret = notification_db_exec(db, query, NULL);
+       if (ret != NOTIFICATION_ERROR_NONE)
+               ERR("notification_db_exec");
+
+       sqlite3_free(query);
+       notification_db_close(&db);
+}