remove unused function: replace records in plugin 65/79565/3
authorJeesun Kim <iamjs.kim@samsung.com>
Tue, 12 Jul 2016 01:10:31 +0000 (10:10 +0900)
committerJeesun Kim <iamjs.kim@samsung.com>
Tue, 12 Jul 2016 23:51:25 +0000 (08:51 +0900)
Change-Id: I030583cf1a656c5eb14e995575453d536d70edee

server/db/cal_db_plugin_calendar.c
server/db/cal_db_plugin_event.c
server/db/cal_db_plugin_extended.c
server/db/cal_db_plugin_todo.c

index fb375d9..9fba60a 100644 (file)
@@ -47,7 +47,6 @@ static int _cal_db_calendar_delete_records(int ids[], int count);
 static int _cal_db_calendar_get_count(int *out_count);
 static int _cal_db_calendar_get_count_with_query(calendar_query_h query, int *out_count);
 static int _cal_db_calendar_replace_record(calendar_record_h record, int id);
-static int _cal_db_calendar_replace_records(const calendar_list_h list, int ids[], int count);
 
 /*
  * static function
@@ -74,7 +73,7 @@ cal_db_plugin_cb_s cal_db_calendar_plugin_cb = {
        .get_count = _cal_db_calendar_get_count,
        .get_count_with_query = _cal_db_calendar_get_count_with_query,
        .replace_record = _cal_db_calendar_replace_record,
-       .replace_records = _cal_db_calendar_replace_records
+       .replace_records = NULL
 };
 
 static bool _cal_db_calendar_check_value_validation(cal_book_s* calendar)
@@ -678,44 +677,6 @@ static int _cal_db_calendar_delete_records(int ids[], int count)
        return CALENDAR_ERROR_NONE;
 }
 
-static int _cal_db_calendar_replace_records(const calendar_list_h list, int ids[], int count)
-{
-       calendar_record_h record;
-       int i = 0;
-       int ret = 0;
-
-       if (NULL == list) {
-               /* LCOV_EXCL_START */
-               ERR("Invalid argument: list is NULL");
-               return CALENDAR_ERROR_INVALID_PARAMETER;
-               /* LCOV_EXCL_STOP */
-       }
-
-       ret = calendar_list_first(list);
-       if (CALENDAR_ERROR_NONE != ret) {
-               /* LCOV_EXCL_START */
-               ERR("list first error");
-               return ret;
-               /* LCOV_EXCL_STOP */
-       }
-
-       for (i = 0; i < count; i++) {
-               if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
-                       ret = _cal_db_calendar_replace_record(record, ids[i]);
-                       if (CALENDAR_ERROR_NONE != ret) {
-                               /* LCOV_EXCL_START */
-                               ERR("_cal_db_calendar_replace_record() Fail(%d)", ret);
-                               return ret;
-                               /* LCOV_EXCL_STOP */
-                       }
-               }
-               if (CALENDAR_ERROR_NO_DATA != calendar_list_next(list))
-                       break;
-       }
-
-       return CALENDAR_ERROR_NONE;
-}
-
 static int _cal_db_calendar_get_count(int *out_count)
 {
        RETV_IF(NULL == out_count, CALENDAR_ERROR_INVALID_PARAMETER);
index 793b0f7..8776c02 100644 (file)
@@ -44,7 +44,6 @@ static int _cal_db_event_update_record(calendar_record_h record);
 static int _cal_db_event_delete_record(int id);
 static int _cal_db_event_replace_record(calendar_record_h record, int id);
 static int _cal_db_event_delete_records(int ids[], int count);
-static int _cal_db_event_replace_records(const calendar_list_h list, int ids[], int count);
 static int _cal_db_event_get_record(int id, calendar_record_h* out_record);
 static int _cal_db_event_get_all_records(int offset, int limit, calendar_list_h* out_list);
 static int _cal_db_event_get_records_with_query(calendar_query_h query, int offset, int limit, calendar_list_h* out_list);
@@ -102,7 +101,7 @@ cal_db_plugin_cb_s cal_db_event_plugin_cb = {
        .insert_records = NULL,
        .update_records = NULL,
        .delete_records = _cal_db_event_delete_records,
-       .replace_records = _cal_db_event_replace_records,
+       .replace_records = NULL,
        .get_record = _cal_db_event_get_record,
        .get_all_records = _cal_db_event_get_all_records,
        .get_records_with_query = _cal_db_event_get_records_with_query,
@@ -1664,44 +1663,6 @@ static int _cal_db_event_replace_record(calendar_record_h record, int id)
        return CALENDAR_ERROR_NONE;
 }
 
-static int _cal_db_event_replace_records(const calendar_list_h list, int ids[], int count)
-{
-       calendar_record_h record;
-       int i = 0;
-       int ret = 0;
-
-       if (NULL == list) {
-               /* LCOV_EXCL_START */
-               ERR("Invalid argument: list is NULL");
-               return CALENDAR_ERROR_INVALID_PARAMETER;
-               /* LCOV_EXCL_STOP */
-       }
-
-       ret = calendar_list_first(list);
-       if (CALENDAR_ERROR_NONE != ret) {
-               /* LCOV_EXCL_START */
-               ERR("list first error");
-               return ret;
-               /* LCOV_EXCL_STOP */
-       }
-
-       for (i = 0; i < count; i++) {
-               if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
-                       ret = _cal_db_event_replace_record(record, ids[i]);
-                       if (CALENDAR_ERROR_NONE != ret) {
-                               /* LCOV_EXCL_START */
-                               ERR("_cal_db_event_replace_record() Fail(%d)", ret);
-                               return CALENDAR_ERROR_DB_FAILED;
-                               /* LCOV_EXCL_STOP */
-                       }
-               }
-               if (CALENDAR_ERROR_NO_DATA != calendar_list_next(list))
-                       break;
-       }
-
-       return CALENDAR_ERROR_NONE;
-}
-
 static void _cal_db_event_get_stmt(sqlite3_stmt *stmt, bool is_view_table, calendar_record_h record,
                int *exception, int *extended)
 {
index 9e9061a..14d9017 100644 (file)
@@ -36,13 +36,10 @@ static int _cal_db_extended_update_record(calendar_record_h record);
 static int _cal_db_extended_delete_record(int id);
 static int _cal_db_extended_get_all_records(int offset, int limit, calendar_list_h* out_list);
 static int _cal_db_extended_get_records_with_query(calendar_query_h query, int offset, int limit, calendar_list_h* out_list);
-static int _cal_db_extended_insert_records(const calendar_list_h list, int** ids);
-static int _cal_db_extended_update_records(const calendar_list_h list);
 static int _cal_db_extended_delete_records(int ids[], int count);
 static int _cal_db_extended_get_count(int *out_count);
 static int _cal_db_extended_get_count_with_query(calendar_query_h query, int *out_count);
 static int _cal_db_extended_replace_record(calendar_record_h record, int id);
-static int _cal_db_extended_replace_records(const calendar_list_h list, int ids[], int count);
 
 /*
  * static function
@@ -64,13 +61,13 @@ cal_db_plugin_cb_s cal_db_extended_plugin_cb = {
        .delete_record = _cal_db_extended_delete_record,
        .get_all_records = _cal_db_extended_get_all_records,
        .get_records_with_query = _cal_db_extended_get_records_with_query,
-       .insert_records = _cal_db_extended_insert_records,
-       .update_records = _cal_db_extended_update_records,
+       .insert_records = NULL,
+       .update_records = NULL,
        .delete_records = _cal_db_extended_delete_records,
        .get_count = _cal_db_extended_get_count,
        .get_count_with_query = _cal_db_extended_get_count_with_query,
        .replace_record = _cal_db_extended_replace_record,
-       .replace_records = _cal_db_extended_replace_records
+       .replace_records = NULL
 };
 
 static int _cal_db_extended_insert_record(calendar_record_h record, int* id)
@@ -461,82 +458,6 @@ static int _cal_db_extended_get_records_with_query(calendar_query_h query, int o
 
        return CALENDAR_ERROR_NONE;
 }
-static int _cal_db_extended_insert_records(const calendar_list_h list, int** ids)
-{
-       calendar_record_h record;
-       int ret = 0;
-       int count = 0;
-       int i = 0;
-       int *id = NULL;
-
-       ret = calendar_list_get_count(list, &count);
-       if (CALENDAR_ERROR_NONE != ret) {
-               /* LCOV_EXCL_START */
-               ERR("list get error");
-               return ret;
-               /* LCOV_EXCL_STOP */
-       }
-
-       id = calloc(1, sizeof(int)*count);
-
-       RETVM_IF(NULL == id, CALENDAR_ERROR_OUT_OF_MEMORY, "calloc() Fail");
-
-       ret = calendar_list_first(list);
-       if (CALENDAR_ERROR_NONE != ret) {
-               /* LCOV_EXCL_START */
-               ERR("list first error");
-               CAL_FREE(id);
-               return ret;
-               /* LCOV_EXCL_STOP */
-       }
-       do {
-               if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
-                       ret = _cal_db_extended_insert_record(record, &id[i]);
-                       if (CALENDAR_ERROR_NONE != ret) {
-                               /* LCOV_EXCL_START */
-                               ERR("_cal_db_extended_insert_record() Fail(%d)", ret);
-                               CAL_FREE(id);
-                               return CALENDAR_ERROR_DB_FAILED;
-                               /* LCOV_EXCL_STOP */
-                       }
-               }
-               i++;
-       } while (CALENDAR_ERROR_NO_DATA != calendar_list_next(list));
-
-       if (ids)
-               *ids = id;
-       else
-               CAL_FREE(id);
-
-       return CALENDAR_ERROR_NONE;
-}
-
-static int _cal_db_extended_update_records(const calendar_list_h list)
-{
-       calendar_record_h record;
-       int ret = 0;
-
-       ret = calendar_list_first(list);
-       if (CALENDAR_ERROR_NONE != ret) {
-               /* LCOV_EXCL_START */
-               ERR("list first error");
-               return ret;
-               /* LCOV_EXCL_STOP */
-       }
-       do {
-               if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
-                       ret = _cal_db_extended_update_record(record);
-                       if (CALENDAR_ERROR_NONE != ret) {
-                               /* LCOV_EXCL_START */
-                               ERR("_cal_db_extended_update_record() Fail(%d)", ret);
-                               return CALENDAR_ERROR_DB_FAILED;
-                               /* LCOV_EXCL_STOP */
-                       }
-               }
-       } while (CALENDAR_ERROR_NO_DATA != calendar_list_next(list));
-
-       return CALENDAR_ERROR_NONE;
-}
 
 static int _cal_db_extended_delete_records(int ids[], int count)
 {
@@ -554,44 +475,6 @@ static int _cal_db_extended_delete_records(int ids[], int count)
        return CALENDAR_ERROR_NONE;
 }
 
-static int _cal_db_extended_replace_records(const calendar_list_h list, int ids[], int count)
-{
-       calendar_record_h record;
-       int i;
-       int ret = 0;
-
-       if (NULL == list) {
-               /* LCOV_EXCL_START */
-               ERR("Invalid argument: list is NULL");
-               return CALENDAR_ERROR_INVALID_PARAMETER;
-               /* LCOV_EXCL_STOP */
-       }
-
-       ret = calendar_list_first(list);
-       if (CALENDAR_ERROR_NONE != ret) {
-               /* LCOV_EXCL_START */
-               ERR("list first error");
-               return ret;
-               /* LCOV_EXCL_STOP */
-       }
-
-       for (i = 0; i < count; i++) {
-               if (CALENDAR_ERROR_NONE == calendar_list_get_current_record_p(list, &record)) {
-                       ret = _cal_db_extended_replace_record(record, ids[i]);
-                       if (CALENDAR_ERROR_NONE != ret) {
-                               /* LCOV_EXCL_START */
-                               ERR("_cal_db_extended_replace_record() Fail(%d)", ret);
-                               return CALENDAR_ERROR_DB_FAILED;
-                               /* LCOV_EXCL_STOP */
-                       }
-               }
-               if (CALENDAR_ERROR_NO_DATA != calendar_list_next(list))
-                       break;
-       }
-
-       return CALENDAR_ERROR_NONE;
-}
-
 static int _cal_db_extended_get_count(int *out_count)
 {
        char query[CAL_DB_SQL_MAX_LEN] = {0};
index e91d822..f65deca 100644 (file)
@@ -46,7 +46,6 @@ static int _cal_db_todo_delete_records(int ids[], int count);
 static int _cal_db_todo_get_count(int *out_count);
 static int _cal_db_todo_get_count_with_query(calendar_query_h query, int *out_count);
 static int _cal_db_todo_replace_record(calendar_record_h record, int id);
-static int _cal_db_todo_replace_records(const calendar_list_h list, int ids[], int count);
 
 /*
  * static function
@@ -75,7 +74,7 @@ cal_db_plugin_cb_s cal_db_todo_plugin_cb = {
        .get_count = _cal_db_todo_get_count,
        .get_count_with_query = _cal_db_todo_get_count_with_query,
        .replace_record = _cal_db_todo_replace_record,
-       .replace_records = _cal_db_todo_replace_records
+       .replace_records = NULL
 };
 
 static int _cal_db_todo_insert_record(calendar_record_h record, int* id)
@@ -1224,45 +1223,6 @@ static int _cal_db_todo_get_count(int *out_count)
        return CALENDAR_ERROR_NONE;
 }
 
-static int _cal_db_todo_replace_records(const calendar_list_h list, int ids[], int count)
-{
-       calendar_record_h record;
-       int i = 0;
-       int ret = 0;
-
-       if (NULL == list) {
-               /* LCOV_EXCL_START */
-               ERR("Invalid argument: list is NULL");
-               return CALENDAR_ERROR_INVALID_PARAMETER;
-               /* LCOV_EXCL_STOP */
-       }
-
-       ret = calendar_list_first(list);
-       if (CALENDAR_ERROR_NONE != ret) {
-               /* LCOV_EXCL_START */
-               ERR("list first error");
-               return ret;
-               /* LCOV_EXCL_STOP */
-       }
-
-       for (i = 0; i < count; i++) {
-               if (CALENDAR_ERROR_NONE ==  calendar_list_get_current_record_p(list, &record)) {
-                       ret = _cal_db_todo_replace_record(record, ids[i]);
-                       if (CALENDAR_ERROR_NONE != ret) {
-                               /* LCOV_EXCL_START */
-                               ERR("_cal_db_todo_replace_record() Fail(%d)", ret);
-                               return CALENDAR_ERROR_DB_FAILED;
-                               /* LCOV_EXCL_STOP */
-                       }
-               }
-               if (CALENDAR_ERROR_NO_DATA != calendar_list_next(list))
-                       break;
-       }
-
-       return CALENDAR_ERROR_NONE;
-}
-
-
 static int _cal_db_todo_get_count_with_query(calendar_query_h query, int *out_count)
 {
        cal_query_s *que = NULL;