extern int utc_contacts_service2_db_search_records_with_query_n(void);
extern int utc_contacts_service2_db_search_records_with_range_p(void);
extern int utc_contacts_service2_db_search_records_with_range_n(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_p(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_n(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_query_p(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_query_n(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_range_p(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_range_n(void);
extern int utc_contacts_service2_db_search_records_for_snippet_p(void);
extern int utc_contacts_service2_db_search_records_for_snippet_n(void);
extern int utc_contacts_service2_db_search_records_with_query_for_snippet_p(void);
{"utc_contacts_service2_db_search_records_with_query_n",utc_contacts_service2_db_search_records_with_query_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_with_range_p",utc_contacts_service2_db_search_records_with_range_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_with_range_n",utc_contacts_service2_db_search_records_with_range_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_p",utc_contacts_service2_db_get_count_for_search_records_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_n",utc_contacts_service2_db_get_count_for_search_records_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_query_p",utc_contacts_service2_db_get_count_for_search_records_with_query_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_query_n",utc_contacts_service2_db_get_count_for_search_records_with_query_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_range_p",utc_contacts_service2_db_get_count_for_search_records_with_range_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_range_n",utc_contacts_service2_db_get_count_for_search_records_with_range_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_for_snippet_p",utc_contacts_service2_db_search_records_for_snippet_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_for_snippet_n",utc_contacts_service2_db_search_records_for_snippet_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_with_query_for_snippet_p",utc_contacts_service2_db_search_records_with_query_for_snippet_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
extern int utc_contacts_service2_db_search_records_with_query_n(void);
extern int utc_contacts_service2_db_search_records_with_range_p(void);
extern int utc_contacts_service2_db_search_records_with_range_n(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_p(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_n(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_query_p(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_query_n(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_range_p(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_range_n(void);
extern int utc_contacts_service2_db_search_records_for_snippet_p(void);
extern int utc_contacts_service2_db_search_records_for_snippet_n(void);
extern int utc_contacts_service2_db_search_records_with_query_for_snippet_p(void);
{"utc_contacts_service2_db_search_records_with_query_n",utc_contacts_service2_db_search_records_with_query_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_with_range_p",utc_contacts_service2_db_search_records_with_range_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_with_range_n",utc_contacts_service2_db_search_records_with_range_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_p",utc_contacts_service2_db_search_records_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_n",utc_contacts_service2_db_search_records_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_query_p",utc_contacts_service2_db_search_records_with_query_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_query_n",utc_contacts_service2_db_search_records_with_query_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_range_p",utc_contacts_service2_db_search_records_with_range_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_range_n",utc_contacts_service2_db_search_records_with_range_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_for_snippet_p",utc_contacts_service2_db_search_records_for_snippet_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_for_snippet_n",utc_contacts_service2_db_search_records_for_snippet_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_with_query_for_snippet_p",utc_contacts_service2_db_search_records_with_query_for_snippet_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
extern int utc_contacts_service2_db_search_records_with_query_n(void);
extern int utc_contacts_service2_db_search_records_with_range_p(void);
extern int utc_contacts_service2_db_search_records_with_range_n(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_p(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_n(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_query_p(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_query_n(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_range_p(void);
+extern int utc_contacts_service2_db_get_count_for_search_records_with_range_n(void);
extern int utc_contacts_service2_db_search_records_for_snippet_p(void);
extern int utc_contacts_service2_db_search_records_for_snippet_n(void);
extern int utc_contacts_service2_db_search_records_with_query_for_snippet_p(void);
{"utc_contacts_service2_db_search_records_with_query_n",utc_contacts_service2_db_search_records_with_query_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_with_range_p",utc_contacts_service2_db_search_records_with_range_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_with_range_n",utc_contacts_service2_db_search_records_with_range_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_p",utc_contacts_service2_db_get_count_for_search_records_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_n",utc_contacts_service2_db_get_count_for_search_records_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_query_p",utc_contacts_service2_db_get_count_for_search_records_with_query_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_query_n",utc_contacts_service2_db_get_count_for_search_records_with_query_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_range_p",utc_contacts_service2_db_get_count_for_search_records_with_range_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_get_count_for_search_records_with_range_n",utc_contacts_service2_db_get_count_for_search_records_with_range_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
+ {"utc_contacts_service2_db_search_records_for_snippet_p",utc_contacts_service2_db_search_records_for_snippet_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_for_snippet_p",utc_contacts_service2_db_search_records_for_snippet_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_for_snippet_n",utc_contacts_service2_db_search_records_for_snippet_n,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
{"utc_contacts_service2_db_search_records_with_query_for_snippet_p",utc_contacts_service2_db_search_records_with_query_for_snippet_p,utc_contacts_service2_db_startup,utc_contacts_service2_db_cleanup},
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_activity_photo(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_activity(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_address_book(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_address(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_company(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_get_chages_by_version_contact_updated_info(int account_id)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_contact(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_email(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_event(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_extension(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_get_chages_by_version_group_member_updated_info(int account_id)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_group_relation(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_get_chages_by_version_group_updated_info(int account_id)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_group(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_get_chages_by_version_grouprel_updated_info(int account_id)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_image(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_messenger(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_get_chages_by_version_my_profile_updated_info(int account_id)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_my_profile(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_name(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_nickname(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_note(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_number(void)
static int _ctsvc_tc_db_search_records_for_snippet_person(int account_id);
static int _ctsvc_tc_db_search_records_with_query_for_snippet_person(int account_id);
static int _ctsvc_tc_db_search_records_with_range_for_snippet_person(int account_id);
+static int _ctsvc_tc_db_get_count_for_search_records_person(int account_id);
+static int _ctsvc_tc_db_get_count_for_search_records_with_query_person(int account_id);
+static int _ctsvc_tc_db_get_count_for_search_records_with_range_person(int account_id);
ctsvc_tc_db_plugin_s _tc_db_person = {
.db_search_records_for_snippet = _ctsvc_tc_db_search_records_for_snippet_person,
.db_search_records_with_query_for_snippet = _ctsvc_tc_db_search_records_with_query_for_snippet_person,
.db_search_records_with_range_for_snippet = _ctsvc_tc_db_search_records_with_range_for_snippet_person,
+ .db_get_count_for_search_records = _ctsvc_tc_db_get_count_for_search_records_person,
+ .db_get_count_for_search_records_with_query = _ctsvc_tc_db_get_count_for_search_records_with_query_person,
+ .db_get_count_for_search_records_with_range = _ctsvc_tc_db_get_count_for_search_records_with_range_person,
};
static int _ctsvc_tc_db_add_changed_cb_person(void)
contacts_record_destroy(record, true);
return ret;
}
+
+
+static int _ctsvc_tc_db_get_count_for_search_records_person(int account_id)
+{
+ int ret = 0;
+ int ids[2]= {0};
+ int ids_count = 0;
+ int address_book_id = 0;
+ int group_id = 0;
+ int count = 0;
+ if (account_id <= 0)
+ return -1;
+
+ do {
+ if (0 != (ret = ctsvc_tc_db_insert_record_address_book(account_id, &address_book_id))) break;
+ if (0 != (ret = ctsvc_tc_db_insert_record_group(address_book_id, &group_id))) break;
+
+ if (0 != (ret = ctsvc_tc_db_insert_record_person(address_book_id, group_id, PROPERTY_TYPE_CREATE1, &(ids[0])))) break;
+ if (0 != (ret = ctsvc_tc_db_insert_record_person(address_book_id, group_id, PROPERTY_TYPE_CREATE1, &(ids[1])))) break;
+ ids_count = 2;
+
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_get_count_for_search_records(_contacts_person._uri, "010", &count))) break;
+ if (count < 1) {
+ ret = -1;
+ break;
+ }
+
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_delete_records(_contacts_person._uri, ids, ids_count))) break;
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_delete_record(_contacts_group._uri, group_id))) break;
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_delete_record(_contacts_address_book._uri, address_book_id))) break;
+
+ return 0;
+ } while (0);
+
+ contacts_db_delete_records(_contacts_person._uri, ids, ids_count);
+ contacts_db_delete_record(_contacts_group._uri, group_id);
+ contacts_db_delete_record(_contacts_address_book._uri, address_book_id);
+
+ return ret;
+}
+
+static int _ctsvc_tc_db_get_count_for_search_records_with_query_person(int account_id)
+{
+ int ret = 0;
+ int ids[2]= {0};
+ int ids_count = 0;
+ int address_book_id = 0;
+ int group_id = 0;
+ contacts_query_h query = NULL;
+ contacts_filter_h filter = NULL;
+ int count = 0;
+ if (account_id <= 0)
+ return -1;
+
+ do {
+ if (0 != (ret = ctsvc_tc_db_insert_record_address_book(account_id, &address_book_id))) break;
+ if (0 != (ret = ctsvc_tc_db_insert_record_group(address_book_id, &group_id))) break;
+
+ if (0 != (ret = ctsvc_tc_db_insert_record_person(address_book_id, group_id, PROPERTY_TYPE_CREATE1, &(ids[0])))) break;
+ if (0 != (ret = ctsvc_tc_db_insert_record_person(address_book_id, group_id, PROPERTY_TYPE_CREATE1, &(ids[1])))) break;
+ ids_count = 2;
+
+ if (CONTACTS_ERROR_NONE != (ret = contacts_query_create(_contacts_person._uri, &query))) break;
+ if (CONTACTS_ERROR_NONE != (ret = contacts_filter_create(_contacts_person._uri, &filter))) break;
+ if (CONTACTS_ERROR_NONE != (ret = contacts_filter_add_int(filter, _contacts_person.id, CONTACTS_MATCH_EQUAL, ids[1]))) break;
+ if (CONTACTS_ERROR_NONE != (ret = contacts_query_set_filter(query, filter))) break;
+
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_get_count_for_search_records_with_query(query, "010", &count))) break;
+ if (count < 1) {
+ ret = -1;
+ break;
+ }
+
+ contacts_filter_destroy(filter);
+ filter = NULL;
+ contacts_query_destroy(query);
+ query = NULL;
+
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_delete_records(_contacts_person._uri, ids, ids_count))) break;
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_delete_record(_contacts_group._uri, group_id))) break;
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_delete_record(_contacts_address_book._uri, address_book_id))) break;
+
+ return 0;
+ } while (0);
+
+ contacts_filter_destroy(filter);
+ contacts_query_destroy(query);
+ contacts_db_delete_records(_contacts_person._uri, ids, ids_count);
+ contacts_db_delete_record(_contacts_group._uri, group_id);
+ contacts_db_delete_record(_contacts_address_book._uri, address_book_id);
+
+ return ret;
+}
+
+static int _ctsvc_tc_db_get_count_for_search_records_with_range_person(int account_id)
+{
+ int ret = 0;
+ int ids[2]= {0};
+ int ids_count = 0;
+ int address_book_id = 0;
+ int group_id = 0;
+ int count = 0;
+ if (account_id <= 0)
+ return -1;
+
+ do {
+ if (0 != (ret = ctsvc_tc_db_insert_record_address_book(account_id, &address_book_id))) break;
+ if (0 != (ret = ctsvc_tc_db_insert_record_group(address_book_id, &group_id))) break;
+
+ if (0 != (ret = ctsvc_tc_db_insert_record_person(address_book_id, group_id, PROPERTY_TYPE_CREATE1, &(ids[0])))) break;
+ if (0 != (ret = ctsvc_tc_db_insert_record_person(address_book_id, group_id, PROPERTY_TYPE_CREATE1, &(ids[1])))) break;
+ ids_count = 2;
+
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_get_count_for_search_records_with_range(_contacts_person._uri, "010", CONTACTS_SEARCH_RANGE_NAME | CONTACTS_SEARCH_RANGE_NUMBER, &count))) break;
+ if (count < 1) {
+ ret = -1;
+ break;
+ }
+
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_delete_records(_contacts_person._uri, ids, ids_count))) break;
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_delete_record(_contacts_group._uri, group_id))) break;
+ if (CONTACTS_ERROR_NONE != (ret = contacts_db_delete_record(_contacts_address_book._uri, address_book_id))) break;
+
+ return 0;
+ } while (0);
+
+ contacts_db_delete_records(_contacts_person._uri, ids, ids_count);
+ contacts_db_delete_record(_contacts_group._uri, group_id);
+ contacts_db_delete_record(_contacts_address_book._uri, address_book_id);
+
+ return ret;
+}
+
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_get_records_with_query_phone_log_stat(int account_id)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_phone_log(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_profile(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_relationship(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_sdn(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_simple_contact(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_sip(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_speeddial(void)
.db_search_records_for_snippet = NULL,
.db_search_records_with_query_for_snippet = NULL,
.db_search_records_with_range_for_snippet = NULL,
+ .db_get_count_for_search_records = NULL,
+ .db_get_count_for_search_records_with_query = NULL,
+ .db_get_count_for_search_records_with_range = NULL,
};
static int _ctsvc_tc_db_add_changed_cb_url(void)
#define API_NAME_CONTACTS_DB_SEARCH_RECORDS "contacts_db_search_records"
#define API_NAME_CONTACTS_DB_SEARCH_RECORDS_WITH_QUERY "contacts_db_search_records_with_query"
#define API_NAME_CONTACTS_DB_SEARCH_RECORDS_WITH_RANGE "contacts_db_search_records_with_range"
+#define API_NAME_CONTACTS_DB_GET_COUNT_FOR_SEARCH_RECORDS "contacts_db_get_count_for_search_records"
+#define API_NAME_CONTACTS_DB_GET_COUNT_FOR_SEARCH_RECORDS_WITH_QUERY "contacts_db_get_count_for_search_records_with_query"
+#define API_NAME_CONTACTS_DB_GET_COUNT_FOR_SEARCH_RECORDS_WITH_RANGE "contacts_db_get_count_for_search_records_with_range"
#define API_NAME_CONTACTS_DB_ADD_CHANGED_CB "contacts_db_add_changed_cb"
#define API_NAME_CONTACTS_DB_REMOVE_CHANGED_CB "contacts_db_remove_changed_cb"
}
+/**
+ * @testcase utc_contacts_service2_db_get_count_for_search_records_p
+ * @since_tizen 2.3
+ * @description Test finding records based on a given keyword.
+ */
+int utc_contacts_service2_db_get_count_for_search_records_p(void)
+{
+ assert_eq(_startup_err, 0);
+
+ int i;
+ int ret;
+ int account_id =0;
+
+ if (false == ctsvc_tc_util_is_contact_support()) {
+ int count = 0;
+ ret = contacts_db_get_count_for_search_records(NULL, "", &count);
+ assert_eq(ret, CONTACTS_ERROR_NOT_SUPPORTED);
+ return 0;
+ }
+
+ ret = ctsvc_tc_util_account_insert(&account_id);
+ assert_eq(0, ret);
+ for (i=0;i<VIEW_MAX;i++) {
+ ctsvc_tc_db_plugin_s *tc_db_plugin = _ctsvc_tc_get_db_plugin(i);
+ if (tc_db_plugin && tc_db_plugin->db_get_count_for_search_records) {
+ ret = tc_db_plugin->db_get_count_for_search_records(account_id);
+ assert_eq(0, ret);
+ }
+ }
+ assert_eq(0, ret);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_contacts_service2_db_get_count_for_search_records_n
+ * @since_tizen 2.3
+ * @description Test fail finding records with invalid parameters.
+ */
+int utc_contacts_service2_db_get_count_for_search_records_n(void)
+{
+ assert_eq(_startup_err, 0);
+
+ int i;
+ int ret;
+ int count = 0;
+
+ ret = contacts_db_get_count_for_search_records(NULL, "", &count);
+ if (false == ctsvc_tc_util_is_contact_support()) {
+ assert_eq(CONTACTS_ERROR_NOT_SUPPORTED, ret);
+ return 0;
+ } else {
+ assert_eq(CONTACTS_ERROR_INVALID_PARAMETER, ret);
+ }
+
+ for (i=0;i<VIEW_MAX;i++) {
+ ret = contacts_db_get_count_for_search_records(ctsvc_tc_util_get_view_uri(i), "", NULL);
+ assert_eq(CONTACTS_ERROR_INVALID_PARAMETER, ret);
+ }
+
+ return 0;
+}
+
+
+/**
+ * @testcase utc_contacts_service2_db_get_count_for_search_records_with_query_p
+ * @since_tizen 2.3
+ * @description Test finding records based on given query and keyword.
+ */
+int utc_contacts_service2_db_get_count_for_search_records_with_query_p(void)
+{
+ assert_eq(_startup_err, 0);
+
+ int i;
+ int ret;
+ int account_id =0;
+
+ if (false == ctsvc_tc_util_is_contact_support()) {
+ int count = 0;
+ ret = contacts_db_get_count_for_search_records_with_query(NULL, "", &count);
+ assert_eq(ret, CONTACTS_ERROR_NOT_SUPPORTED);
+ return 0;
+ }
+
+ ret = ctsvc_tc_util_account_insert(&account_id);
+ assert_eq(0, ret);
+ for (i=0;i<VIEW_MAX;i++) {
+ ctsvc_tc_db_plugin_s *tc_db_plugin = _ctsvc_tc_get_db_plugin(i);
+ if (tc_db_plugin && tc_db_plugin->db_get_count_for_search_records_with_query) {
+ ret = tc_db_plugin->db_get_count_for_search_records_with_query(account_id);
+ assert_eq(0, ret);
+ }
+ }
+ assert_eq(0, ret);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_contacts_service2_db_get_count_for_search_records_with_query_n
+ * @since_tizen 2.3
+ * @description Test fail finding records based on given query and keyword with invalid parameters.
+ */
+int utc_contacts_service2_db_get_count_for_search_records_with_query_n(void)
+{
+ assert_eq(_startup_err, 0);
+
+ int i;
+ int ret;
+ int count = 0;
+ contacts_query_h query = NULL;
+
+ ret = contacts_db_get_count_for_search_records_with_query(NULL, "", &count);
+ if (false == ctsvc_tc_util_is_contact_support()) {
+ assert_eq(CONTACTS_ERROR_NOT_SUPPORTED, ret);
+ return 0;
+ } else {
+ assert_eq(CONTACTS_ERROR_INVALID_PARAMETER, ret);
+ }
+
+ for (i=0;i<VIEW_MAX;i++) {
+ ret = contacts_query_create(ctsvc_tc_util_get_view_uri(i), &query);
+ assert_eq(CONTACTS_ERROR_NONE, ret);
+
+ ret = contacts_db_get_count_for_search_records_with_query(query, "", NULL);
+ assert_eq(CONTACTS_ERROR_INVALID_PARAMETER, ret);
+
+ ret = contacts_query_destroy(query);
+ assert_eq(CONTACTS_ERROR_NONE, ret);
+ }
+
+ return 0;
+}
+
+
+
+
+/**
+ * @testcase utc_contacts_service2_db_get_count_for_search_records_with_range_p
+ * @since_tizen 2.3
+ * @description Test finding records based on a keyword and range.
+ */
+int utc_contacts_service2_db_get_count_for_search_records_with_range_p(void)
+{
+ assert_eq(_startup_err, 0);
+
+ int i;
+ int ret;
+ int account_id =0;
+
+ if (false == ctsvc_tc_util_is_contact_support()) {
+ int count = 0;
+ ret = contacts_db_get_count_for_search_records_with_range(NULL, "", CONTACTS_SEARCH_RANGE_DATA, &count);
+ assert_eq(ret, CONTACTS_ERROR_NOT_SUPPORTED);
+ return 0;
+ }
+
+ ret = ctsvc_tc_util_account_insert(&account_id);
+ assert_eq(0, ret);
+ for (i=0;i<VIEW_MAX;i++) {
+ ctsvc_tc_db_plugin_s *tc_db_plugin = _ctsvc_tc_get_db_plugin(i);
+ if (tc_db_plugin && tc_db_plugin->db_get_count_for_search_records_with_range) {
+ ret = tc_db_plugin->db_get_count_for_search_records_with_range(account_id);
+ assert_eq(0, ret);
+ }
+ }
+ assert_eq(0, ret);
+
+ return 0;
+}
+
+/**
+ * @testcase utc_contacts_service2_db_get_count_for_search_records_with_range_n
+ * @since_tizen 2.3
+ * @description Test fail finding records based on a keyword and range with invalid parameters.
+ */
+int utc_contacts_service2_db_get_count_for_search_records_with_range_n(void)
+{
+ assert_eq(_startup_err, 0);
+
+ int i;
+ int ret;
+ int count = 0;
+
+ ret = contacts_db_get_count_for_search_records_with_range(NULL, "", CONTACTS_SEARCH_RANGE_DATA, &count);
+ if (false == ctsvc_tc_util_is_contact_support()) {
+ assert_eq(CONTACTS_ERROR_NOT_SUPPORTED, ret);
+ return 0;
+ } else {
+ assert_eq(CONTACTS_ERROR_INVALID_PARAMETER, ret);
+ }
+
+ for (i=0;i<VIEW_MAX;i++) {
+ ret = contacts_db_get_count_for_search_records_with_range(ctsvc_tc_util_get_view_uri(i), "", 0, &count);
+ assert_eq(CONTACTS_ERROR_INVALID_PARAMETER, ret);
+ ret = contacts_db_get_count_for_search_records_with_range(ctsvc_tc_util_get_view_uri(i), "", CONTACTS_SEARCH_RANGE_DATA, NULL);
+ assert_eq(CONTACTS_ERROR_INVALID_PARAMETER, ret);
+ }
+
+ return 0;
+}
+
+
+
/**
* @testcase utc_contacts_service2_db_search_records_for_snippet_p
* @since_tizen 3.0
tc_with_account_id db_search_records_for_snippet;
tc_with_account_id db_search_records_with_query_for_snippet;
tc_with_account_id db_search_records_with_range_for_snippet;
+ tc_with_account_id db_get_count_for_search_records;
+ tc_with_account_id db_get_count_for_search_records_with_query;
+ tc_with_account_id db_get_count_for_search_records_with_range;
} ctsvc_tc_db_plugin_s;
typedef enum {