}
+//& purpose: Gets the number of found records based on a given keyword.
+//& type: auto
+/**
+* @testcase ITc_contacts_db_get_count_for_search_records_p
+* @since_tizen 5.5
+* @author SRID(j.abhishek)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the number of found records based on a given keyword.
+* @scenario Connect to contacts service\n
+* inserts multiple records in the database\n
+* deletes multiple records from the database\n
+* Disconnect the contacts service
+* @apicovered contacts_db_get_count_for_search_records
+* @passcase When contacts_db_get_count_for_search_records and pre-conditions are successful.
+* @failcase If target API fails or any precondition API fails.
+* @precondition NA
+* @postcondition None
+*/
+int ITc_contacts_db_get_count_for_search_records_p(void)
+{
+ START_TEST;
+
+ unsigned int nGetRecordCnt = 0;
+ int nRet;
+
+ // Target API
+ nRet = contacts_db_get_count_for_search_records(_contacts_person._uri, "010", &nGetRecordCnt);
+
+ if(!g_bIsContactFeatureSupported)
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[Line : %d][%s] contacts_db_get_count_for_search_records API call returned mismatch %s error for unsupported contact feature\\n", __LINE__, API_NAMESPACE, ContactsServiceGetError(nRet));
+ return 1;
+ }
+ else
+ {
+ FPRINTF("[Line : %d][%s] contacts_db_get_count_for_search_records API call correctly returned %s error for unsupported contact feature\\n", __LINE__, API_NAMESPACE, ContactsServiceGetError(nRet));
+ return 0;
+ }
+ }
+
+ PRINT_RESULT(CONTACTS_ERROR_NONE, nRet, "contacts_db_get_count_for_search_records", ContactsServiceGetError(nRet));
+ FPRINTF("[Line : %d][%s] contacts_db_get_count_for_search_records, record count is = %d\\n", __LINE__, API_NAMESPACE, nGetRecordCnt);
+
+ return 0;
+}
+
+//& purpose: Gets the number of found records based on a given keyword and query.
+//& type: auto
+
+/**
+* @testcase ITc_contacts_db_get_count_for_search_records_with_query_p
+* @since_tizen 5.5
+* @author SRID(j.abhishek)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the number of found records based on a given keyword and query.
+* @scenario Connect to contacts service\n
+* inserts multiple records in the database\n
+* deletes multiple records from the database\n
+* Disconnect the contacts service
+* @apicovered contacts_db_get_count_for_search_records_with_query
+* @passcase When contacts_db_get_count_for_search_records_with_query and pre-conditions are successful.
+* @failcase If target API fails or any precondition API fails.
+* @precondition NA
+* @postcondition None
+*/
+int ITc_contacts_db_get_count_for_search_records_with_query_p(void)
+{
+ START_TEST;
+
+ contacts_query_h hContactQuery = NULL;
+ contacts_filter_h hContactFilter = NULL;
+
+ int nRet;
+ unsigned int nGetRecordCnt = 0;
+
+ nRet = contacts_query_create(_contacts_person._uri, &hContactQuery);
+ PRINT_RESULT(CONTACTS_ERROR_NONE, nRet, "contacts_query_create", ContactsServiceGetError(nRet));
+
+ if(!g_bIsContactFeatureSupported)
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[Line : %d][%s] contacts_query_create API call returned mismatch %s error for unsupported contact feature\\n", __LINE__, API_NAMESPACE, ContactsServiceGetError(nRet));
+ return 1;
+ }
+ else
+ {
+ FPRINTF("[Line : %d][%s] contacts_query_create API call correctly returned %s error for unsupported contact feature\\n", __LINE__, API_NAMESPACE, ContactsServiceGetError(nRet));
+ return 0;
+ }
+ }
+
+ nRet = contacts_filter_create(_contacts_person._uri, &hContactFilter);
+ PRINT_RESULT_CLEANUP(CONTACTS_ERROR_NONE, nRet, "contacts_filter_create", ContactsServiceGetError(nRet), contacts_query_destroy(hContactQuery));
+
+ nRet = contacts_filter_add_int(hContactFilter, _contacts_person.id, CONTACTS_MATCH_LESS_THAN_OR_EQUAL, g_nFirstPersonId);
+ PRINT_RESULT_CLEANUP(CONTACTS_ERROR_NONE, nRet, "contacts_filter_add_int", ContactsServiceGetError(nRet), contacts_query_destroy(hContactQuery); contacts_filter_destroy(hContactFilter));
+
+ nRet = contacts_query_set_filter(hContactQuery, hContactFilter);
+ PRINT_RESULT_CLEANUP(CONTACTS_ERROR_NONE, nRet, "contacts_query_set_filter", ContactsServiceGetError(nRet), contacts_query_destroy(hContactQuery); contacts_filter_destroy(hContactFilter));
+
+ // Target API
+ nRet = contacts_db_get_count_for_search_records_with_query(hContactQuery, "010", &nGetRecordCnt);
+ PRINT_RESULT_CLEANUP(CONTACTS_ERROR_NONE, nRet, "contacts_db_get_count_for_search_records_with_query", ContactsServiceGetError(nRet), contacts_query_destroy(hContactQuery); contacts_filter_destroy(hContactFilter));
+ FPRINTF("[Line : %d][%s] contacts_db_get_count_for_search_records_with_query, record count is = %d\\n", __LINE__, API_NAMESPACE, nGetRecordCnt);
+
+ nRet = contacts_filter_destroy(hContactFilter);
+ PRINT_RESULT_NORETURN(CONTACTS_ERROR_NONE, nRet, "contacts_filter_destroy", ContactsServiceGetError(nRet));
+
+ nRet = contacts_query_destroy(hContactQuery);
+ PRINT_RESULT_NORETURN(CONTACTS_ERROR_NONE, nRet, "contacts_query_destroy", ContactsServiceGetError(nRet));
+
+ return 0;
+}
+
+//& purpose: Gets the number of found records based on a given keyword and range.
+//& type: auto
+/**
+* @testcase ITc_contacts_db_get_count_for_search_records_with_range_p
+* @since_tizen 5.5
+* @author SRID(j.abhishek)
+* @reviewer SRID(shobhit.v)
+* @type auto
+* @description Gets the number of found records based on a given keyword and range.
+* @scenario Connect to contacts service\n
+* inserts multiple records in the database\n
+* deletes multiple records from the database\n
+* Disconnect the contacts service
+* @apicovered contacts_db_get_count_for_search_records_with_range
+* @passcase When contacts_db_get_count_for_search_records_with_range and pre-conditions are successful.
+* @failcase If target API fails or any precondition API fails.
+* @precondition NA
+* @postcondition None
+*/
+int ITc_contacts_db_get_count_for_search_records_with_range_p(void)
+{
+ START_TEST;
+
+ int nRet;
+ unsigned int nGetRecordCnt = 0;
+
+ // Target API
+ nRet = contacts_db_get_count_for_search_records_with_range(_contacts_person._uri, "010", CONTACTS_SEARCH_RANGE_NAME | CONTACTS_SEARCH_RANGE_NUMBER, &nGetRecordCnt);
+
+ if(!g_bIsContactFeatureSupported)
+ {
+ if ( nRet != TIZEN_ERROR_NOT_SUPPORTED )
+ {
+ FPRINTF("[Line : %d][%s] contacts_db_get_count_for_search_records_with_range API call returned mismatch %s error for unsupported contact feature\\n", __LINE__, API_NAMESPACE, ContactsServiceGetError(nRet));
+ return 1;
+ }
+ else
+ {
+ FPRINTF("[Line : %d][%s] contacts_db_get_count_for_search_records_with_range API call correctly returned %s error for unsupported contact feature\\n", __LINE__, API_NAMESPACE, ContactsServiceGetError(nRet));
+ return 0;
+ }
+ }
+
+ PRINT_RESULT(CONTACTS_ERROR_NONE, nRet, "contacts_db_get_count_for_search_records_with_range", ContactsServiceGetError(nRet));
+ FPRINTF("[Line : %d][%s] contacts_db_get_count_for_search_records_with_range, record count is = %d\\n", __LINE__, API_NAMESPACE, nGetRecordCnt);
+
+ return 0;
+}
+
/** @} */
/** @} */
extern int ITc_contacts_record_create_destroy_sip_p(void);
extern int ITc_contacts_record_set_get_str_sip_p(void);
extern int ITc_contacts_record_set_get_int_sip_p(void);
+extern int ITc_contacts_db_get_count_for_search_records_p(void);
+extern int ITc_contacts_db_get_count_for_search_records_with_range_p(void);
+extern int ITc_contacts_db_get_count_for_search_records_with_query_p(void);
testcase tc_array[] = {
{"ITc_contacts_connect_disconnect_p",ITc_contacts_connect_disconnect_p,ITs_contacts_service2_database_startup,ITs_contacts_service2_database_cleanup},
{"ITc_contacts_record_create_destroy_sip_p",ITc_contacts_record_create_destroy_sip_p,ITs_contacts_service2_sip_startup,ITs_contacts_service2_sip_cleanup},
{"ITc_contacts_record_set_get_str_sip_p",ITc_contacts_record_set_get_str_sip_p,ITs_contacts_service2_sip_startup,ITs_contacts_service2_sip_cleanup},
{"ITc_contacts_record_set_get_int_sip_p",ITc_contacts_record_set_get_int_sip_p,ITs_contacts_service2_sip_startup,ITs_contacts_service2_sip_cleanup},
+ {"ITc_contacts_db_get_count_for_search_records_p", ITc_contacts_db_get_count_for_search_records_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
+ {"ITc_contacts_db_get_count_for_search_records_with_range_p", ITc_contacts_db_get_count_for_search_records_with_range_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
+ {"ITc_contacts_db_get_count_for_search_records_with_query_p", ITc_contacts_db_get_count_for_search_records_with_query_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
{NULL, NULL}
};
extern int ITc_contacts_record_create_destroy_sip_p(void);
extern int ITc_contacts_record_set_get_str_sip_p(void);
extern int ITc_contacts_record_set_get_int_sip_p(void);
+extern int ITc_contacts_db_get_count_for_search_records_p(void);
+extern int ITc_contacts_db_get_count_for_search_records_with_range_p(void);
+extern int ITc_contacts_db_get_count_for_search_records_with_query_p(void);
testcase tc_array[] = {
{"ITc_contacts_connect_disconnect_p",ITc_contacts_connect_disconnect_p,ITs_contacts_service2_database_startup,ITs_contacts_service2_database_cleanup},
{"ITc_contacts_record_create_destroy_sip_p",ITc_contacts_record_create_destroy_sip_p,ITs_contacts_service2_sip_startup,ITs_contacts_service2_sip_cleanup},
{"ITc_contacts_record_set_get_str_sip_p",ITc_contacts_record_set_get_str_sip_p,ITs_contacts_service2_sip_startup,ITs_contacts_service2_sip_cleanup},
{"ITc_contacts_record_set_get_int_sip_p",ITc_contacts_record_set_get_int_sip_p,ITs_contacts_service2_sip_startup,ITs_contacts_service2_sip_cleanup},
+ {"ITc_contacts_db_get_count_for_search_records_p", ITc_contacts_db_get_count_for_search_records_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
+ {"ITc_contacts_db_get_count_for_search_records_with_range_p", ITc_contacts_db_get_count_for_search_records_with_range_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
+ {"ITc_contacts_db_get_count_for_search_records_with_query_p", ITc_contacts_db_get_count_for_search_records_with_query_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
{NULL, NULL}
};
extern int ITc_contacts_record_create_destroy_sip_p(void);
extern int ITc_contacts_record_set_get_str_sip_p(void);
extern int ITc_contacts_record_set_get_int_sip_p(void);
+extern int ITc_contacts_db_get_count_for_search_records_p(void);
+extern int ITc_contacts_db_get_count_for_search_records_with_range_p(void);
+extern int ITc_contacts_db_get_count_for_search_records_with_query_p(void);
testcase tc_array[] = {
{"ITc_contacts_connect_disconnect_p",ITc_contacts_connect_disconnect_p,ITs_contacts_service2_database_startup,ITs_contacts_service2_database_cleanup},
{"ITc_contacts_record_create_destroy_sip_p",ITc_contacts_record_create_destroy_sip_p,ITs_contacts_service2_sip_startup,ITs_contacts_service2_sip_cleanup},
{"ITc_contacts_record_set_get_str_sip_p",ITc_contacts_record_set_get_str_sip_p,ITs_contacts_service2_sip_startup,ITs_contacts_service2_sip_cleanup},
{"ITc_contacts_record_set_get_int_sip_p",ITc_contacts_record_set_get_int_sip_p,ITs_contacts_service2_sip_startup,ITs_contacts_service2_sip_cleanup},
+ {"ITc_contacts_db_get_count_for_search_records_p", ITc_contacts_db_get_count_for_search_records_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
+ {"ITc_contacts_db_get_count_for_search_records_with_range_p", ITc_contacts_db_get_count_for_search_records_with_range_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
+ {"ITc_contacts_db_get_count_for_search_records_with_query_p", ITc_contacts_db_get_count_for_search_records_with_query_p, ITs_contacts_service2_database_startup, ITs_contacts_service2_database_cleanup},
{NULL, NULL}
};