-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;
-}