From 9c7b44ce79f9272f02dbd83a491320b17143401b Mon Sep 17 00:00:00 2001 From: youngsub ko Date: Fri, 28 Jun 2013 13:59:42 +0900 Subject: [PATCH] releasing notification --- include/notification_debug.h | 2 +- packaging/notification.spec | 2 +- src/notification_noti.c | 50 +++++++++++++++++++++++++++++++++----------- src/notification_ongoing.c | 2 -- 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/include/notification_debug.h b/include/notification_debug.h index 519d3ae..114a2ee 100755 --- a/include/notification_debug.h +++ b/include/notification_debug.h @@ -22,7 +22,7 @@ #ifndef __NOTIFICATION_DEBUG_H__ #define __NOTIFICATION_DEBUG_H__ -#define LOG_TAG "notification" +#define LOG_TAG "NOTIFICATION" #include #ifndef EXPORT_API diff --git a/packaging/notification.spec b/packaging/notification.spec index 74b1bef..56e858b 100755 --- a/packaging/notification.spec +++ b/packaging/notification.spec @@ -1,6 +1,6 @@ Name: notification Summary: notification library -Version: 0.2.7 +Version: 0.2.9 Release: 1 Group: TBD License: Apache-2.0 diff --git a/src/notification_noti.c b/src/notification_noti.c index 9743069..825b0dd 100755 --- a/src/notification_noti.c +++ b/src/notification_noti.c @@ -31,6 +31,8 @@ #include #include +#define NOTI_BURST_DELETE_UNIT 10 + static int _notification_noti_bind_query_text(sqlite3_stmt * stmt, const char *name, const char *str) { @@ -980,6 +982,7 @@ err: EXPORT_API int notification_noti_delete_all(notification_type_e type, const char *pkgname, int *num_deleted, int **list_deleted_rowid) { int ret = NOTIFICATION_ERROR_NONE; + int ret_tmp = NOTIFICATION_ERROR_NONE; int i = 0, data_cnt = 0; sqlite3 *db = NULL; sqlite3_stmt *stmt = NULL; @@ -1058,15 +1061,26 @@ EXPORT_API int notification_noti_delete_all(notification_type_e type, const char if (data_cnt > 0) { query_where[0] = '\0'; + snprintf(query_base, sizeof(query_base) - 1, "delete from noti_list"); for (i = 0; i < data_cnt ; i++) { - snprintf(buf, sizeof(buf), "%s%d", (i == 0) ? "" : ",", *((*list_deleted_rowid) + i)); + if (i % NOTI_BURST_DELETE_UNIT == 0 && i != 0) { + snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where); + ret_tmp = notification_db_exec(db, query, NULL); + query_where[0] = '\0'; + if (ret == NOTIFICATION_ERROR_NONE) { + ret = ret_tmp; + } + } + snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i)); strncat(query_where, buf,sizeof(query_where) - strlen(query_where) - 1); } - snprintf(query_base, sizeof(query_base), "delete from noti_list"); - snprintf(query, sizeof(query), "%s where priv_id in (%s)", query_base, query_where); - - NOTIFICATION_ERR("check : %s", query); - ret = notification_db_exec(db, query, NULL); + if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0) ) { + snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where); + ret_tmp = notification_db_exec(db, query, NULL); + if (ret == NOTIFICATION_ERROR_NONE) { + ret = ret_tmp; + } + } } else { free(*list_deleted_rowid); *list_deleted_rowid = NULL; @@ -1103,6 +1117,7 @@ int notification_noti_delete_group_by_group_id(const char *pkgname, int group_id, int *num_deleted, int **list_deleted_rowid) { int ret = NOTIFICATION_ERROR_NONE; + int ret_tmp = NOTIFICATION_ERROR_NONE; sqlite3 *db = NULL; int i = 0, data_cnt = 0; sqlite3_stmt *stmt = NULL; @@ -1167,15 +1182,26 @@ int notification_noti_delete_group_by_group_id(const char *pkgname, if (data_cnt > 0) { query_where[0] = '\0'; + snprintf(query_base, sizeof(query_base) - 1, "delete from noti_list"); for (i = 0; i < data_cnt ; i++) { - snprintf(buf, sizeof(buf), "%s%d", (i == 0) ? "" : ",", *((*list_deleted_rowid) + i)); + if (i % NOTI_BURST_DELETE_UNIT == 0 && i != 0) { + snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where); + ret_tmp = notification_db_exec(db, query, NULL); + query_where[0] = '\0'; + if (ret == NOTIFICATION_ERROR_NONE) { + ret = ret_tmp; + } + } + snprintf(buf, sizeof(buf) - 1, "%s%d", (i % NOTI_BURST_DELETE_UNIT == 0) ? "" : ",", *((*list_deleted_rowid) + i)); strncat(query_where, buf,sizeof(query_where) - strlen(query_where) - 1); } - snprintf(query_base, sizeof(query_base), "delete from noti_list"); - snprintf(query, sizeof(query), "%s where priv_id in (%s)", query_base, query_where); - - NOTIFICATION_ERR("check : %s", query); - ret = notification_db_exec(db, query, NULL); + if ((i <= NOTI_BURST_DELETE_UNIT) || ((i % NOTI_BURST_DELETE_UNIT) > 0) ) { + snprintf(query, sizeof(query) - 1, "%s where priv_id in (%s)", query_base, query_where); + ret_tmp = notification_db_exec(db, query, NULL); + if (ret == NOTIFICATION_ERROR_NONE) { + ret = ret_tmp; + } + } } else { free(*list_deleted_rowid); *list_deleted_rowid = NULL; diff --git a/src/notification_ongoing.c b/src/notification_ongoing.c index 38fb585..eea1860 100755 --- a/src/notification_ongoing.c +++ b/src/notification_ongoing.c @@ -115,8 +115,6 @@ notification_error_e notification_ongoing_update_size(const char *caller_pkgname dbus_message_unref(signal); if (ret) { - NOTIFICATION_INFO("Send size info : %s(%d) %.2f", - caller_pkgname, priv_id, size); return NOTIFICATION_ERROR_NONE; } -- 2.7.4