Tizen Native API  5.0
Query

The contacts Query API provides the set of definitions and interfaces that enable application developers to make query to get list.

Required Header

#include <contacts.h>

Functions

int contacts_query_create (const char *view_uri, contacts_query_h *query)
 Creates a query.
int contacts_query_destroy (contacts_query_h query)
 Destroys a query.
int contacts_query_set_projection (contacts_query_h query, unsigned int property_id_array[], int count)
 Adds property IDs for projection.
int contacts_query_set_distinct (contacts_query_h query, bool set)
 Sets the "distinct" option for projection.
int contacts_query_set_filter (contacts_query_h query, contacts_filter_h filter)
 Sets a filter for query.
int contacts_query_set_sort (contacts_query_h query, unsigned int property_id, bool is_ascending)
 Sets a sort mode for query.

Function Documentation

int contacts_query_create ( const char *  view_uri,
contacts_query_h *  query 
)

Creates a query.

Since :
2.3
Remarks:
You must release query using contacts_query_destroy().
Parameters:
[in]view_uriThe view URI of a query
[out]queryThe filter handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONTACTS_ERROR_NONESuccessful
CONTACTS_ERROR_INVALID_PARAMETERInvalid parameter
CONTACTS_ERROR_OUT_OF_MEMORYOut of memory
CONTACTS_ERROR_NOT_SUPPORTEDNot supported
CONTACTS_ERROR_SYSTEMInternal system module error
Precondition:
contacts_connect() should be called to initialize
See also:
contacts_query_destroy()
int contacts_query_destroy ( contacts_query_h  query)

Destroys a query.

Since :
2.3
Parameters:
[in]queryThe query handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONTACTS_ERROR_NONESuccessful
CONTACTS_ERROR_INVALID_PARAMETERInvalid parameter
CONTACTS_ERROR_NOT_SUPPORTEDNot supported
CONTACTS_ERROR_SYSTEMInternal system module error
See also:
contacts_query_create()
int contacts_query_set_distinct ( contacts_query_h  query,
bool  set 
)

Sets the "distinct" option for projection.

Since :
2.3
Parameters:
[in]queryThe query handle
[in]setSet true to set the distinct option for projection, otherwise false to unset the distinct option
Returns:
0 on success, otherwise a negative error value
Return values:
CONTACTS_ERROR_NONESuccessful
CONTACTS_ERROR_INVALID_PARAMETERInvalid parameter
CONTACTS_ERROR_NOT_SUPPORTEDNot supported
CONTACTS_ERROR_SYSTEMInternal system module error
int contacts_query_set_filter ( contacts_query_h  query,
contacts_filter_h  filter 
)

Sets a filter for query.

Since :
2.3
Parameters:
[in]queryThe query handle
[in]filterThe filter handle
Returns:
0 on success, otherwise a negative error value
Return values:
CONTACTS_ERROR_NONESuccessful
CONTACTS_ERROR_INVALID_PARAMETERInvalid parameter
CONTACTS_ERROR_NOT_SUPPORTEDNot supported
CONTACTS_ERROR_SYSTEMInternal system module error
See also:
contacts_filter_create()
int contacts_query_set_projection ( contacts_query_h  query,
unsigned int  property_id_array[],
int  count 
)

Adds property IDs for projection.

Since :
2.3
Parameters:
[in]queryThe query handle
[in]property_id_arrayThe property ID array
[in]countThe number of property IDs
Returns:
0 on success, otherwise a negative error value
Return values:
CONTACTS_ERROR_NONESuccessful
CONTACTS_ERROR_INVALID_PARAMETERInvalid parameter
CONTACTS_ERROR_NOT_SUPPORTEDNot supported
CONTACTS_ERROR_SYSTEMInternal system module error
int contacts_query_set_sort ( contacts_query_h  query,
unsigned int  property_id,
bool  is_ascending 
)

Sets a sort mode for query.

Since :
2.3
Parameters:
[in]queryThe query handle
[in]property_idThe property ID to sort
[in]is_ascendingSet true for ascending sort mode, otherwise false for descending sort mode
Returns:
0 on success, otherwise a negative error value
Return values:
CONTACTS_ERROR_NONESuccessful
CONTACTS_ERROR_INVALID_PARAMETERInvalid parameter
CONTACTS_ERROR_NOT_SUPPORTEDNot supported
CONTACTS_ERROR_SYSTEMInternal system module error