Tizen Native API  5.0
Data Control Consumer

All applications can request data shared by other applications using data control.

Required Header

#include <data_control.h>

Overview

You can get a datacontrol_h instance from data_control_map_create() or data_control_sql_create().

Functions

int data_control_bulk_data_get_data (data_control_bulk_data_h bulk_data, int idx, bundle **data)
 Gets the n-th bundle from bulk data.
int data_control_bulk_data_get_count (data_control_bulk_data_h bulk_data, int *count)
 Gets the bulk data bundle count.
int data_control_bulk_data_add (data_control_bulk_data_h bulk_data, bundle *data)
 Adds a bundle to bulk data.
int data_control_bulk_data_create (data_control_bulk_data_h *bulk_data)
 Creates bulk data.
int data_control_bulk_data_destroy (data_control_bulk_data_h bulk_data)
 Destroys bulk data.
int data_control_bulk_result_data_get_result_data (data_control_bulk_result_data_h result_data, int idx, bundle **data, int *result)
 Gets the n-th bundle from bulk result data.
int data_control_bulk_result_data_get_count (data_control_bulk_result_data_h result_data, int *count)
 Gets the bulk result data bundle count.
int data_control_bulk_result_data_add (data_control_bulk_result_data_h result_data, bundle *data, int result)
 Adds bulk data.
int data_control_bulk_result_data_create (data_control_bulk_result_data_h *result_data)
 Creates bulk result data.
int data_control_bulk_result_data_destroy (data_control_bulk_result_data_h result_data)
 Destroys bulk result data.
int data_control_map_create (data_control_h *provider)
 Creates a provider handle.
int data_control_map_destroy (data_control_h provider)
 Destroys the provider handle and releases all its resources.
int data_control_map_set_provider_id (data_control_h provider, const char *provider_id)
 Sets the Provider ID.
int data_control_map_get_provider_id (data_control_h provider, char **provider_id)
 Gets the Provider ID.
int data_control_map_set_data_id (data_control_h provider, const char *data_id)
 Sets the Data ID.
int data_control_map_get_data_id (data_control_h provider, char **data_id)
 Gets the data ID.
int data_control_map_register_response_cb (data_control_h provider, data_control_map_response_cb *callback, void *user_data)
 Registers a callback function for the key-value structured data control response. The application is notified when a data control response is received from the provider.
int data_control_map_unregister_response_cb (data_control_h provider)
 Unregisters the callback function in the provider.
int data_control_map_get (data_control_h provider, const char *key, int *request_id)
 Gets the value list associated with the specified key from the key-values map owned by the key-value structured data control provider.
int data_control_map_get_with_page (data_control_h provider, const char *key, int *request_id, int page_number, int count_per_page)
 Gets the value list associated with the specified key from the key-values map owned by the key-value structured data control provider, with partition into pages.
int data_control_map_set (data_control_h provider, const char *key, const char *old_value, const char *new_value, int *request_id)
 Sets the value associated with the specified key to a new value.
int data_control_map_add (data_control_h provider, const char *key, const char *value, int *request_id)
 Adds the value associated with the specified key to the key-values map owned by the key-value structured data control provider.
int data_control_map_remove (data_control_h provider, const char *key, const char *value, int *request_id)
 Removes the value associated with the specified key from the key-values map owned by the key-value structured data control provider.
int data_control_map_add_bulk_data (data_control_h provider, data_control_bulk_data_h bulk_data, int *request_id)
 Adds multiple key-value pairs in one request.
int data_control_map_register_add_bulk_data_response_cb (data_control_h provider, data_control_bulk_cb callback, void *user_data)
 Registers an add bulk data callback for the MAP data control response. The application is notified when a data control response is received from the provider.
int data_control_map_unregister_add_bulk_data_response_cb (data_control_h provider)
 Unregisters the add bulk data callback.
int data_control_map_bind_response_cb (data_control_h provider, data_control_map_response_cb *callback, void *user_data)
 Binds a response callback function to a data control provider handle. The application is notified when a data control response is received from the provider.
int data_control_map_unbind_response_cb (data_control_h provider)
 Unbinds the callback function in the provider.
int data_control_map_bind_add_bulk_data_response_cb (data_control_h provider, data_control_bulk_cb callback, void *user_data)
 Binds the add bulk data callback to the map data control response.
int data_control_map_unbind_add_bulk_data_response_cb (data_control_h provider)
 Unbinds the add bulk data callback in the provider.
int data_control_map_get_handle_id (data_control_h provider, int *handle_id)
 Gets the handle ID for provider.
int data_control_add_data_change_cb (data_control_h provider, data_control_data_change_cb callback, void *user_data, data_control_add_callback_result_cb result_callback, void *result_cb_user_data, int *callback_id)
 Asynchronously adds a data changed callback, which is called whenever the provider's data is changed.
int data_control_remove_data_change_cb (data_control_h provider, int callback_id)
 Removes data change callback function.
int data_control_sql_create (data_control_h *provider)
 Creates a provider handle.
int data_control_sql_destroy (data_control_h provider)
 Destroys the provider handle and releases all its resources.
int data_control_sql_set_provider_id (data_control_h provider, const char *provider_id)
 Sets the Provider ID.
int data_control_sql_get_provider_id (data_control_h provider, char **provider_id)
 Gets the Provider ID.
int data_control_sql_set_data_id (data_control_h provider, const char *data_id)
 Sets the data ID.
int data_control_sql_get_data_id (data_control_h provider, char **data_id)
 Gets the data ID.
int data_control_sql_register_response_cb (data_control_h provider, data_control_sql_response_cb *callback, void *user_data)
 Registers a callback function for the SQL data control response.
int data_control_sql_unregister_response_cb (data_control_h provider)
 Unregisters the callback function in the provider.
int data_control_sql_delete (data_control_h provider, const char *where, int *request_id)
 Deletes rows of a table owned by the SQL-type data control provider.
int data_control_sql_insert (data_control_h provider, const bundle *insert_data, int *request_id)
 Inserts new rows in a table owned by the SQL-type data control provider.
int data_control_sql_select (data_control_h provider, char **column_list, int column_count, const char *where, const char *order, int *request_id)
 Selects the specified columns to be queried.
int data_control_sql_select_with_page (data_control_h provider, char **column_list, int column_count, const char *where, const char *order, int page_number, int count_per_page, int *request_id)
 Selects the specified columns to be queried, with partition into pages.
int data_control_sql_update (data_control_h provider, const bundle *update_data, const char *where, int *request_id)
 Updates values of a table owned by the SQL-type data control provider.
int data_control_sql_insert_bulk_data (data_control_h provider, data_control_bulk_data_h bulk_data, int *request_id)
 Inserts multiple rows in one request.
int data_control_sql_register_insert_bulk_data_response_cb (data_control_h provider, data_control_bulk_cb callback, void *user_data)
 Registers an insert bulk data callback for the SQL data control response. The application is notified when a data control response is received from the provider.
int data_control_sql_unregister_insert_bulk_data_response_cb (data_control_h provider)
 Unregisters the insert bulk data callback.
int data_control_sql_bind_response_cb (data_control_h provider, data_control_sql_response_cb *callback, void *user_data)
 Binds a callback function to the SQL data control response.
int data_control_sql_unbind_response_cb (data_control_h provider)
 Unbinds the callback function in the provider.
int data_control_sql_bind_insert_bulk_data_response_cb (data_control_h provider, data_control_bulk_cb callback, void *user_data)
 Binds the insert bulk data callback to the SQL data control response.
int data_control_sql_unbind_insert_bulk_data_response_cb (data_control_h provider)
 Unbinds the insert bulk data callback in the provider.
int data_control_sql_get_handle_id (data_control_h provider, int *handle_id)
 Gets the handle ID for provider.
int data_control_sql_step_first (result_set_cursor cursor)
 Moves the cursor to the first position.
int data_control_sql_step_last (result_set_cursor cursor)
 Moves the cursor to the last position.
int data_control_sql_step_next (result_set_cursor cursor)
 Moves the cursor to the next position.
int data_control_sql_step_previous (result_set_cursor cursor)
 Moves the cursor to the previous position.
int data_control_sql_get_column_count (result_set_cursor cursor)
 Gets the number of columns for this cursor.
int data_control_sql_get_column_name (result_set_cursor cursor, int column_index, char *name)
 Gets the name of the column indicated by the specified index.
int data_control_sql_get_column_item_size (result_set_cursor cursor, int column_index)
 Gets the size of the data in the column indicated by the specified index.
int data_control_sql_get_column_item_type (result_set_cursor cursor, int column_index, data_control_sql_column_type_e *type)
 Gets the type of the column indicated by the specified index.
int data_control_sql_get_blob_data (result_set_cursor cursor, int column_index, void *data, int size)
 Gets a blob data from the column indicated by the specified index.
int data_control_sql_get_int_data (result_set_cursor cursor, int column_index, int *data)
 Gets an int value from the column indicated by the specified index.
int data_control_sql_get_int64_data (result_set_cursor cursor, int column_index, long long *data)
 Gets a long long value from the column indicated by the specified index.
int data_control_sql_get_double_data (result_set_cursor cursor, int column_index, double *data)
 Gets a double value from the column indicated by the specified index.
int data_control_sql_get_text_data (result_set_cursor cursor, int column_index, char *data)
 Gets a text value from the column indicated by the specified index.

Typedefs

typedef void(* data_control_bulk_cb )(int request_id, data_control_h provider, data_control_bulk_result_data_h bulk_results, bool provider_result, const char *error, void *user_data)
 Called when a response is received for a bulk operation from a provider application.
typedef void(* data_control_map_get_response_cb )(int request_id, data_control_h provider, char **result_value_list, int result_value_count, bool provider_result, const char *error, void *user_data)
 Called when the result value list is received from the key-value structured data control provider.
typedef void(* data_control_map_set_response_cb )(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
 Called when the response is received for a set operation from the key-value structured data control provider.
typedef void(* data_control_map_add_response_cb )(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
 Called when the response is received for an add operation from the key-value structured data control provider.
typedef void(* data_control_map_remove_response_cb )(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
 Called when the response is received for a remove operation from the key-value structured data control provider.
typedef void(* data_control_data_change_cb )(data_control_h provider, data_control_data_change_type_e type, bundle *data, void *user_data)
 Called when received data changed notification from provider application.
typedef void(* data_control_add_callback_result_cb )(data_control_h provider, data_control_error_e result, int callback_id, void *user_data)
 Called when the consumer receives the result of the data change callback adding operation.
typedef void(* data_control_sql_insert_response_cb )(int request_id, data_control_h provider, long long inserted_row_id, bool provider_result, const char *error, void *user_data)
 Called when a response is received for an insert operation from an application using the SQL-friendly interface based data control.
typedef void(* data_control_sql_delete_response_cb )(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
 Called when a response is received for a delete operation from an application using the SQL-friendly interface based data control.
typedef void(* data_control_sql_select_response_cb )(int request_id, data_control_h provider, result_set_cursor enumerator, bool provider_result, const char *error, void *user_data)
 Called when a response is received for a select operation from an application using the SQL-friendly interface based data control.
typedef void(* data_control_sql_update_response_cb )(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
 Called when a response is received for an update operation from an application using the SQL-friendly interface based data control.
typedef struct result_set_s * result_set_cursor
 The structure type to represent a SQL result set.

Typedef Documentation

typedef void(* data_control_add_callback_result_cb)(data_control_h provider, data_control_error_e result, int callback_id, void *user_data)

Called when the consumer receives the result of the data change callback adding operation.

The following error codes can be delivered:
DATA_CONTROL_ERROR_NONE,
DATA_CONTROL_ERROR_OUT_OF_MEMORY,
DATA_CONTROL_ERROR_IO_ERROR,
DATA_CONTROL_ERROR_PERMISSION_DENIED,
DATA_CONTROL_ERROR_MAX_EXCEEDED

Since :
3.0
Remarks:
DATA_CONTROL_ERROR_PERMISSION_DENIED will be returned when the provider denies to add the callback.
Parameters:
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed.
[in]resultAdd data change callback result
[in]callback_idAdded callback ID
[in]user_dataThe user data passed from the add function
Precondition:
The callback must be registered using data_control_add_data_change_cb().
See also:
data_control_add_data_change_cb()
typedef void(* data_control_bulk_cb)(int request_id, data_control_h provider, data_control_bulk_result_data_h bulk_results, bool provider_result, const char *error, void *user_data)

Called when a response is received for a bulk operation from a provider application.

Since :
3.0
Parameters:
[in]request_idThe request ID
[in]providerThe provider handle. provider is valid only inside this function.
provider should not be destroyed.
[in]bulk_resultsThe result data for each insert request. bulk_results is valid only inside this function.
bulk_results should not be freed.
[in]provider_resultSet to true if the data control provider successfully processed,
otherwise set to false
[in]errorThe error message from the data control provider. error is valid only inside this function.
error should not be freed.
[in]user_dataThe user data passed from the register function
See also:
data_control_sql_register_insert_bulk_data_response_cb()
data_control_map_register_add_bulk_data_response_cb()
typedef void(* data_control_data_change_cb)(data_control_h provider, data_control_data_change_type_e type, bundle *data, void *user_data)

Called when received data changed notification from provider application.

Since :
3.0
Parameters:
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed.
[in]typeChanged data type
[in]dataData from provider, intended to contain information about changed data
data is valid only inside this function
To use outside the callback, make a copy. data should not be freed
[in]user_dataThe user data passed from the add function
Precondition:
The callback must be registered using data_control_add_data_change_cb().
data_control_provider_send_data_change_noti() must be called to invoke this callback.
See also:
data_control_add_data_change_cb()
data_control_provider_send_data_change_noti()
typedef void(* data_control_map_add_response_cb)(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)

Called when the response is received for an add operation from the key-value structured data control provider.

Since :
2.3
Parameters:
[in]request_idThe request ID that identifies the data control
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed.
[in]provider_resultSet to true if the data control provider successfully processed,
otherwise set to false
[in]errorThe error message from the data control provider
[in]user_dataThe user data passed from the register function
typedef void(* data_control_map_get_response_cb)(int request_id, data_control_h provider, char **result_value_list, int result_value_count, bool provider_result, const char *error, void *user_data)

Called when the result value list is received from the key-value structured data control provider.

Since :
2.3
Remarks:
You must release result_value_list using free() after it is used. Note that result_value list is an array of char *. Its length is result_value_count. You should release all the elements in the result_value_list array and result_value_list itself like the following code.
  int i;
  for (i = 0; i < resule_value_count; i++)
      free(result_value_list[i]);
  free(result_value_list);
Parameters:
[in]request_idThe request ID
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed.
[in]result_value_listThe result value list of the data control request that gets the matching values
[in]result_value_countThe number of the values
[in]provider_resultSet to true if the data control provider is successfully processed,
otherwise set to false
[in]errorThe error message from the data control provider
[in]user_dataThe user data passed from the register function
typedef void(* data_control_map_remove_response_cb)(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)

Called when the response is received for a remove operation from the key-value structured data control provider.

Since :
2.3
Parameters:
[in]request_idThe request ID that identifies the data control
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed.
[in]provider_resultSet to true if the data control provider successfully processed,
otherwise set to false
[in]errorThe error message from the data control provider
[in]user_dataThe user data passed from the register function
typedef void(* data_control_map_set_response_cb)(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)

Called when the response is received for a set operation from the key-value structured data control provider.

Since :
2.3
Parameters:
[in]request_idThe request ID that identifies the data control
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed.
[in]provider_resultSet to true if the data control provider successfully processed,
otherwise false
[in]errorThe error message from the data control provider
[in]user_dataThe user data passed from the register function
typedef void(* data_control_sql_delete_response_cb)(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)

Called when a response is received for a delete operation from an application using the SQL-friendly interface based data control.

Since :
2.3
Parameters:
[in]request_idThe request ID that identifies the data control
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed
[in]provider_resultSet to true if the data control provider successfully processed,
otherwise set to false
[in]errorThe error message from the data control provider
[in]user_dataThe user data passed from the register function
typedef void(* data_control_sql_insert_response_cb)(int request_id, data_control_h provider, long long inserted_row_id, bool provider_result, const char *error, void *user_data)

Called when a response is received for an insert operation from an application using the SQL-friendly interface based data control.

Since :
2.3
Parameters:
[in]request_idThe request ID
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed
[in]inserted_row_idThe inserted row ID set by the data control
[in]provider_resultSet to true if the data control provider successfully processed,
otherwise set to false
[in]errorThe error message from the data control provider
[in]user_dataThe user data passed from the register function
typedef void(* data_control_sql_select_response_cb)(int request_id, data_control_h provider, result_set_cursor enumerator, bool provider_result, const char *error, void *user_data)

Called when a response is received for a select operation from an application using the SQL-friendly interface based data control.

Since :
2.3
Remarks:
enumerator will be removed after the execution of this callback.
Parameters:
[in]request_idThe request ID
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed
[in]enumeratorThe enumerator for navigating the result of data control select request
[in]provider_resultSet to true if the data control provider successfully processed,
otherwise set to false
[in]errorThe error message from the data control provider
[in]user_dataThe user data passed from the register function
typedef void(* data_control_sql_update_response_cb)(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)

Called when a response is received for an update operation from an application using the SQL-friendly interface based data control.

Since :
2.3
Parameters:
[in]request_idThe request ID
[in]providerThe provider handle. provider is valid only inside this function
provider should not be destroyed
[in]provider_resultSet to true if the data control provider successfully processed,
otherwise set to false
[in]errorThe error message from the data control provider
[in]user_dataThe user data passed from the register function
typedef struct result_set_s* result_set_cursor

The structure type to represent a SQL result set.

This type can be used to enumerate through the result set of an SQL query.

Since :
2.3

Function Documentation

int data_control_add_data_change_cb ( data_control_h  provider,
data_control_data_change_cb  callback,
void *  user_data,
data_control_add_callback_result_cb  result_callback,
void *  result_cb_user_data,
int *  callback_id 
)

Asynchronously adds a data changed callback, which is called whenever the provider's data is changed.

The function attempts to add the callback asynchronously and calls result_callback to inform about the result of the attempt.
If the function is successful, result_callback will be called.
The provider will call any filters which were added for the callback addition process.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this function, you must add privileges.
Parameters:
[in]providerTarget provider handle
[in]callbackThe callback function to be called when consumer receives data change notification
[in]user_dataThe user data to be passed to the callback function
[in]result_callbackThe callback function to be called when consumer receives add data change callback process result
[in]result_cb_user_dataThe user data to be passed to the result_callback function
[out]callback_idAdded callback ID, it can be used to remove the callback
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
See also:
data_control_data_change_cb()
data_control_add_callback_result_cb()
data_control_provider_add_data_change_consumer_filter_cb()

Adds a bundle to bulk data.

Since :
3.0
Remarks:
The order in which bundles are added is preserved. Bundle indexes start from 0.
Parameters:
[in]bulk_dataThe bulk data handle
[in]dataThe bundle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Creates bulk data.

Since :
3.0
Remarks:
The bulk_data should be released using data_control_bulk_data_destroy().
Parameters:
[out]bulk_dataThe bulk data handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Destroys bulk data.

Since :
3.0
Parameters:
[in]bulk_dataThe bulk data handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_bulk_data_get_count ( data_control_bulk_data_h  bulk_data,
int *  count 
)

Gets the bulk data bundle count.

Since :
3.0
Parameters:
[in]bulk_dataThe bulk data handle
[out]countThe bundle count
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_bulk_data_get_data ( data_control_bulk_data_h  bulk_data,
int  idx,
bundle **  data 
)

Gets the n-th bundle from bulk data.

Since :
3.0
Remarks:
The data should not be released.
It will be released when data_control_bulk_data_destroy() is called.
Parameters:
[in]bulk_dataThe bulk data handle
[in]idxThe bundle index. Index starts at 0
[out]dataThe n-th bundle.
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_bulk_data_add()
data_control_bulk_data_destroy()
int data_control_bulk_result_data_add ( data_control_bulk_result_data_h  result_data,
bundle data,
int  result 
)

Adds bulk data.

Since :
3.0
Remarks:
The order in which bundles are added is preserved. Bundle indexes start from 0.
Parameters:
[in]result_dataThe bulk result data handle
[in]dataThe bundle
[in]resultBulk operation result. Possible values and their meaning are defined by the developer.
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_bulk_result_data_get_result_data()

Creates bulk result data.

Since :
3.0
Remarks:
The result_data should be released using data_control_bulk_result_data_destroy().
Parameters:
[out]result_dataThe bulk result data handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Destroys bulk result data.

Since :
3.0
Parameters:
[in]result_dataThe bulk result data handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Gets the bulk result data bundle count.

Since :
3.0
Parameters:
[in]result_dataThe bulk result data handle
[out]countThe bundle count
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_bulk_result_data_get_result_data ( data_control_bulk_result_data_h  result_data,
int  idx,
bundle **  data,
int *  result 
)

Gets the n-th bundle from bulk result data.

Since :
3.0
Remarks:
The data should not be released.
It will be released when data_control_bulk_result_data_destroy() is called.
Parameters:
[in]result_dataThe bulk result data handle
[in]idxThe bundle index. Index starts at 0
[out]dataThe n-th bundle
[out]resultBulk operation result. Possible values and their meaning are defined by the developer.
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_bulk_result_data_add()
data_control_bulk_result_data_destroy()
int data_control_map_add ( data_control_h  provider,
const char *  key,
const char *  value,
int *  request_id 
)

Adds the value associated with the specified key to the key-values map owned by the key-value structured data control provider.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
The following example demonstrates how to use the data_control_map_add() method.
  void
  map_add_response_cb(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI("The add operation is successful");
      else
          LOGI("The add operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_map_response_cb map_callback;

  {
      int result = 0;
      int req_id = 0;
      const char *key = "key";
      const char *value = "value";

      map_callback.add_cb = map_add_response_cb;
      result = data_control_map_register_response_cb(provider, &map_callback, NULL);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);

          return result;
      }

      result = data_control_map_add(provider, key, value, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Adding %s-%s pair is failed with error: %d", key, value, result);
      else
          LOGI("req_id is %d", req_id);

      return result;
  }
Parameters:
[in]providerThe provider handle
[in]keyThe key of the value to add
[in]valueThe value to add
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
int data_control_map_add_bulk_data ( data_control_h  provider,
data_control_bulk_data_h  bulk_data,
int *  request_id 
)

Adds multiple key-value pairs in one request.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this function, you must add privileges.
The following example demonstrates how to use the data_control_map_add_bulk_data() method.
  void
  map_bulk_add_response_cb(int request_id, data_control_h provider, data_control_bulk_result_data_h bulk_results,
  bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI("The add operation is successful");
      else
          LOGI("The add operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_map_response_cb map_callback;
  {
      data_control_bulk_data_h bulk_data;
      int req_id;
      bundle *b1;
      bundle *b2;
      int result = 0;
      int req_id = 0;
      int count;

      result = data_control_map_register_add_bulk_data_response_cb(provider, map_bulk_add_response_cb, user_data);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);
          return result;
      }

      b1 = bundle_create();
      bundle_add_str(b1, "key", "test key");
      bundle_add_str(b1, "value", "test value");
      b2 = bundle_create();
      bundle_add_str(b2, "key", "test key2");
      bundle_add_str(b2, "value", "test value2");

      data_control_bulk_data_create(&bulk_data);
      data_control_bulk_data_add(bulk_data, b1);
      data_control_bulk_data_add(bulk_data, b2);

      data_control_bulk_data_get_count(bulk_data, &count);
      dlog_print(DLOG_INFO, LOG_TAG, "bulk add count %d ", count);

      data_control_map_add_bulk_data(provider, bulk_data, &req_id);
      data_control_bulk_data_destroy(bulk_data);

      bundle_free(b1);
      bundle_free(b2);
      return result;
  }
Parameters:
[in]providerThe provider handle
[in]bulk_dataThe bulk data handle
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument. Bulk data total length cannot exceed 1MB
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
int data_control_map_bind_add_bulk_data_response_cb ( data_control_h  provider,
data_control_bulk_cb  callback,
void *  user_data 
)

Binds the add bulk data callback to the map data control response.

This function is very similar to data_control_map_register_add_bulk_data_response_cb(), which can register a callback for a given provider id. Calling data_control_map_register_add_bulk_data_response_cb() again overwrites the callback previously set for the provider id, which means that only one callback can be set for a given id. data_control_map_bind_add_bulk_data_response_cb() binds a callback to the handle of a provider, which allows registering multiple callbacks for a given provider id. To do that, you can create new data_control_h for the same provider id and register callback for the data_control_h.

Since :
4.0
Remarks:
If you call this function multiple times for the same handle, any previously set callback will be overwritten.
Parameters:
[in]providerThe provider handle
[in]callbackThe callback function to be called when a response is received
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_map_register_add_bulk_data_response_cb()
data_control_map_unbind_add_bulk_data_response_cb()
int data_control_map_bind_response_cb ( data_control_h  provider,
data_control_map_response_cb callback,
void *  user_data 
)

Binds a response callback function to a data control provider handle. The application is notified when a data control response is received from the provider.

This function is very similar to data_control_map_register_response_cb(), which can register a callback for a given provider id. Calling data_control_map_register_response_cb() again overwrites the callback previously set for the provider id, which means that only one callback can be set for a given id. data_control_map_bind_response_cb() binds a callback to the handle of a provider, which allows registering multiple callbacks for a given provider id. To do that, you can create new data_control_h for the same provider id and register callback for the data_control_h.

Since :
4.0
Remarks:
If you call this function multiple times for the same handle, any previously set callback will be overwritten.
Parameters:
[in]providerThe provider handle
[in]callbackThe callback function to be called when a response is received
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_map_register_response_cb()
data_control_map_unbind_response_cb()

Creates a provider handle.

Since :
2.3
Remarks:
provider should be destroyed with data_control_map_destroy(). The following example demonstrates how to use the data_control_map_create() method.
  {
      const char *provider_id = "http://tizen.org/datacontrol/provider/example";
      const char *data_id = "table";
      data_control_h provider;
      int result = 0;

      result = data_control_map_create(&provider);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Creating data control provider is failed with error: %d", result);

          return result;
      }

      result = data_control_map_set_provider_id(provider, provider_id);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Setting providerID is failed with error: %d", result);

          return result;
      }

      result = data_control_map_set_data_id(provider, data_id);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Setting dataID is failed with error: %d", result);

          return result;
      }

      // Executes some operations

      result = data_control_map_destroy(provider);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Destroying data control provider is failed with error: %d", result);

      return result;
  }
Parameters:
[out]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_map_destroy()

Destroys the provider handle and releases all its resources.

Since :
2.3
Remarks:
When operations of data control are finished, this function must be called to prevent memory leak.
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_map_create()
int data_control_map_get ( data_control_h  provider,
const char *  key,
int *  request_id 
)

Gets the value list associated with the specified key from the key-values map owned by the key-value structured data control provider.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
If the length of value list associated with the key is larger than 20, this API only returns the first 20 values.
The following example demonstrates how to use the data_control_map_get() method.
  void
  map_get_response_cb(int request_id, data_control_h provider, char **result_value_list,
                      int ret_value_count, bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI("The get operation is successful");
      else
          LOGI("The get operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_map_response_cb map_callback;

  {
      int result = 0;
      int req_id = 0;
      char *key = "key";

      map_callback.get_cb = map_get_response_cb;
      result = data_control_map_register_response_cb(provider, &map_callback, NULL);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);

          return result;
      }

      result = data_control_map_get(provider, key, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Getting the value list of the key(%s) is failed with error: %d", key, result);
      else
          LOGI("req_id is %d", req_id);

      return result;
  }
Parameters:
[in]providerThe provider handle
[in]keyThe key of the value list to obtain
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
See also:
data_control_map_get_with_page()
int data_control_map_get_data_id ( data_control_h  provider,
char **  data_id 
)

Gets the data ID.

Since :
2.3
Remarks:
You must release data_id using free() after it is used.
Parameters:
[in]providerThe provider handle
[out]data_idA string for identifying a specific table to operate
The string consists of one or more components separated by a slash('/').
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_map_set_data_id()
int data_control_map_get_handle_id ( data_control_h  provider,
int *  handle_id 
)

Gets the handle ID for provider.

Since :
4.0
Remarks:
handle_id is generated internally and it is unique for each handle. This function can be used in callbacks to know for which handle the callback was called.
Parameters:
[in]providerThe provider handle
[out]handle_idThe handle ID for provider
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_map_get_provider_id ( data_control_h  provider,
char **  provider_id 
)

Gets the Provider ID.

Since :
2.3
Remarks:
You must release provider_id using free() after it is used.
Parameters:
[in]providerThe provider handle
[out]provider_idThe data control provider ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_map_set_provider_id()
int data_control_map_get_with_page ( data_control_h  provider,
const char *  key,
int *  request_id,
int  page_number,
int  count_per_page 
)

Gets the value list associated with the specified key from the key-values map owned by the key-value structured data control provider, with partition into pages.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
Parameters:
[in]providerThe provider handle
[in]keyThe key of the value list to obtain
[out]request_idThe request ID
[in]page_numberThe page number of the value set
It starts from 1.
[in]count_per_pageThe desired maximum count of the data items per page
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
See also:
data_control_map_get()
int data_control_map_register_add_bulk_data_response_cb ( data_control_h  provider,
data_control_bulk_cb  callback,
void *  user_data 
)

Registers an add bulk data callback for the MAP data control response. The application is notified when a data control response is received from the provider.

Since :
3.0
Remarks:
Only one callback can be registered for each provider id with this function. If you call this function multiple times for the same provider id, any previously set callback will be overwritten.
Parameters:
[in]providerThe provider handle
[in]callbackThe callback function to be called when a response is received
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_map_unregister_add_bulk_data_response_cb()
data_control_map_bind_add_bulk_data_response_cb()
int data_control_map_register_response_cb ( data_control_h  provider,
data_control_map_response_cb callback,
void *  user_data 
)

Registers a callback function for the key-value structured data control response. The application is notified when a data control response is received from the provider.

Since :
2.3
Remarks:
The application is notified when a data control response is received from the provider.
Only one callback can be registered for each provider id with this API.
If you register multiple callback for same provider id, it will be overwritten by latest one.
Parameters:
[in]providerThe provider handle
[in]callbackThe callback function to be called when a response is received
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_map_unregister_response_cb()
data_control_map_bind_response_cb()
int data_control_map_remove ( data_control_h  provider,
const char *  key,
const char *  value,
int *  request_id 
)

Removes the value associated with the specified key from the key-values map owned by the key-value structured data control provider.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
The following example demonstrates how to use the data_control_map_remove() method.
  void
  map_remove_response_cb(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI("The remove operation is successful");
      else
          LOGI("The remove operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_map_response_cb map_callback;

  {
      int result = 0;
      int req_id = 0;
      const char *key = "key";
      const char *value = "value";

      map_callback.remove_cb = map_remove_response_cb;
      result = data_control_map_register_response_cb(provider, &map_callback, NULL);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);

          return result;
      }

      result = data_control_map_remove(provider, key, value, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Removing %s-%s pair is failed with error: %d", key, value, result);
      else
          LOGI("req_id is %d", req_id);

      return result;
  }
Parameters:
[in]providerThe provider handle
[in]keyThe key of the value to remove
[in]valueThe value to remove
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
int data_control_map_set ( data_control_h  provider,
const char *  key,
const char *  old_value,
const char *  new_value,
int *  request_id 
)

Sets the value associated with the specified key to a new value.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
The following example demonstrates how to use the data_control_map_set() method.
  void
  map_set_response_cb(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI("The set operation is successful");
      else
          LOGI("The set operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_map_response_cb map_callback;

  {
      int result = 0;
      int req_id = 0;
      char *key = "key";
      char *old_value = "old value";
      char *new_value = "new value";

      map_callback.set_cb = map_set_response_cb;
      result = data_control_map_register_response_cb(provider, &map_callback, NULL);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);

          return result;
      }

      result = data_control_map_set(provider, key, old_value, new_value, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Replacing old_value(%s) with new_value(%s) is failed with error: %d", old_value, new_value, result);
      else
          LOGI("req_id is %d", req_id);

      return result;
  }
Parameters:
[in]providerThe provider handle
[in]keyThe key of the value to replace
[in]old_valueThe value to replace
[in]new_valueThe new value that replaces the existing value
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
int data_control_map_set_data_id ( data_control_h  provider,
const char *  data_id 
)

Sets the Data ID.

Since :
2.3
Parameters:
[in]providerThe provider handle
[in]data_idA string for identifying a specific table to operate
The string consists of one or more components separated by a slash('/').
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_map_get_data_id()
int data_control_map_set_provider_id ( data_control_h  provider,
const char *  provider_id 
)

Sets the Provider ID.

Since :
2.3
Parameters:
[in]providerThe provider handle
[in]provider_idThe data control provider ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_map_get_provider_id()

Unbinds the add bulk data callback in the provider.

Since :
4.0
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_map_bind_add_bulk_data_response_cb()

Unbinds the callback function in the provider.

Since :
4.0
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_bind_map_response_cb()

Unregisters the add bulk data callback.

Since :
3.0
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_map_register_add_bulk_data_response_cb()

Unregisters the callback function in the provider.

Since :
2.3
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_map_register_response_cb()
int data_control_remove_data_change_cb ( data_control_h  provider,
int  callback_id 
)

Removes data change callback function.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this function, you must add privileges.
Parameters:
[in]providerTarget provider handle
[in]callback_idTarget callback ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
int data_control_sql_bind_insert_bulk_data_response_cb ( data_control_h  provider,
data_control_bulk_cb  callback,
void *  user_data 
)

Binds the insert bulk data callback to the SQL data control response.

This function is very similar to data_control_sql_register_insert_bulk_data_response_cb(), which can register a callback for a given provider id. Calling data_control_sql_register_insert_bulk_data_response_cb() again overwrites the callback previously set for the provider id, which means that only one callback can be set for a given id. data_control_sql_bind_insert_bulk_data_response_cb() binds a callback to the handle of a provider, which allows registering multiple callbacks for a given provider id. To do that, you can create new data_control_h for the same provider id and register callback for the data_control_h.

Since :
4.0
Remarks:
You can bind a callback function to provider. If you call this function multiple times for the same handle, any previously set callback will be overwritten.
Parameters:
[in]providerThe provider handle
[in]callbackThe callback function to be called when a response is received
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_sql_register_insert_bulk_data_response_cb()
data_control_sql_unbind_insert_bulk_data_response_cb()
int data_control_sql_bind_response_cb ( data_control_h  provider,
data_control_sql_response_cb callback,
void *  user_data 
)

Binds a callback function to the SQL data control response.

This function is very similar to data_control_sql_register_response_cb(), which can register a callback for a given provider id. Calling data_control_sql_register_response_cb() again overwrites the callback previously set for the provider id, which means that only one callback can be set for a given id. data_control_sql_bind_response_cb() binds a callback to the handle of a provider, which allows registering multiple callbacks for a given provider id. To do that, you can create new data_control_h for the same provider id and register callback for the data_control_h.

Since :
4.0
Remarks:
You can bind a callback function to provider. If you call this function multiple times for the same handle, any previously set callback will be overwritten.
Parameters:
[in]providerThe provider handle
[in]callbackThe callback function to be called when a response is received
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_sql_register_response_cb()
data_control_sql_unbind_response_cb()

Creates a provider handle.

Since :
2.3
Remarks:
provider should be destroyed with data_control_sql_destroy(). The following example demonstrates how to use the data_control_sql_create() method:
  {
      const char *provider_id = "http://tizen.org/datacontrol/provider/example";
      const char *data_id = "table";
      data_control_h provider;
      int result = 0;

      result = data_control_sql_create(&provider);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Creating data control provider is failed with error: %d", result);

          return result;
      }

      result = data_control_sql_set_provider_id(provider, provider_id);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Setting providerID is failed with error: %d", result);

          return result;
      }

      result = data_control_sql_set_data_id(provider, data_id);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Setting dataID is failed with error: %d", result);

          return result;
      }

      // Executes some operations

      result = data_control_sql_destroy(provider);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Destroying data control provider is failed with error: %d", result);

      return result;
  }
Parameters:
[out]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_sql_destroy()
int data_control_sql_delete ( data_control_h  provider,
const char *  where,
int *  request_id 
)

Deletes rows of a table owned by the SQL-type data control provider.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
If the value is a string, then the value must be wrapped in single quotes, else it does not need to be wrapped in single quotes.
The following example demonstrates how to use the data_control_sql_delete() method:
  void
  sql_delete_response_cb(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI(The delete operation is successful");
      else
          LOGI("The delete operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_sql_response_cb sql_callback;

  {
      const char *where = "group = 'friend'";
      int result = 0;
      int req_id = 0;

      sql_callback.delete_cb = sql_delete_response_cb;
      result = data_control_sql_register_response_cb(provider, &sql_callback, void *user_data);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);

          return result;
      }

      result = data_control_sql_delete(provider, where, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Deleting is failed with error: %d", result);
      else
          LOGI("req_id is %d", req_id);

      return result;
  }
Parameters:
[in]providerThe provider handle
[in]whereA filter to select the desired rows to delete
It is an SQL 'WHERE' clause excluding the 'WHERE' itself such as column1 = 'stringValue' and column2 = numericValue
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied

Destroys the provider handle and releases all its resources.

Since :
2.3
Remarks:
When operations of data control are finished, this function must be called to prevent the memory leak.
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_sql_create()
int data_control_sql_get_blob_data ( result_set_cursor  cursor,
int  column_index,
void *  data,
int  size 
)

Gets a blob data from the column indicated by the specified index.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
[in]column_indexThe index of the destination column
[out]dataThe blob value obtained from the column
[out]sizeThe size of the data
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Gets the number of columns for this cursor.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
Returns:
The number of columns in the calling cursor
Return values:
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_sql_get_column_item_size ( result_set_cursor  cursor,
int  column_index 
)

Gets the size of the data in the column indicated by the specified index.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
[in]column_indexThe index of the destination column
Returns:
The size of data in the column indicated by the specified index
If an error is occurred, then a negative value is returned
Return values:
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Gets the type of the column indicated by the specified index.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
[in]column_indexThe index of the destination column
[out]typeThe type of the destination column
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_sql_get_column_name ( result_set_cursor  cursor,
int  column_index,
char *  name 
)

Gets the name of the column indicated by the specified index.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
[in]column_indexThe index of the destination column
[out]nameThe name of the destination column. You should provide a buffer for the column name. The limit of column name length is 4096 bytes
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_sql_get_data_id ( data_control_h  provider,
char **  data_id 
)

Gets the data ID.

Since :
2.3
Remarks:
You must release data_id using free() after it is used.
Parameters:
[in]providerThe provider handle
[out]data_idA string for identifying a specific table to operate
The string consists of one or more components separated by a slash('/')
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_sql_set_data_id()
int data_control_sql_get_double_data ( result_set_cursor  cursor,
int  column_index,
double *  data 
)

Gets a double value from the column indicated by the specified index.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
[in]column_indexThe index of the destination column
[out]dataThe value obtained from the column as double
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_sql_get_handle_id ( data_control_h  provider,
int *  handle_id 
)

Gets the handle ID for provider.

Since :
4.0
Remarks:
handle_id is generated internally and it is unique for each handle. This function can be used in callbacks to know for which handle the callback was called.
Parameters:
[in]providerThe provider handle
[out]handle_idThe handle ID for provider
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_sql_get_int64_data ( result_set_cursor  cursor,
int  column_index,
long long *  data 
)

Gets a long long value from the column indicated by the specified index.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
[in]column_indexThe index of the destination column
[out]dataThe 64-bit integer value obtained from the column
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_sql_get_int_data ( result_set_cursor  cursor,
int  column_index,
int *  data 
)

Gets an int value from the column indicated by the specified index.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
[in]column_indexThe index of the destination column
[out]dataThe integer value obtained from the column
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
int data_control_sql_get_provider_id ( data_control_h  provider,
char **  provider_id 
)

Gets the Provider ID.

Since :
2.3
Remarks:
You must release provider_id using free() after it is used.
Parameters:
[in]providerThe provider handle
[out]provider_idThe data control provider ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_sql_set_provider_id()
int data_control_sql_get_text_data ( result_set_cursor  cursor,
int  column_index,
char *  data 
)

Gets a text value from the column indicated by the specified index.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
[in]column_indexThe index of the destination column
[out]dataThe value obtained from the column as text. You should provide a buffer for the data. You can get the size of data via data_control_sql_get_column_item_size()
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
int data_control_sql_insert ( data_control_h  provider,
const bundle insert_data,
int *  request_id 
)

Inserts new rows in a table owned by the SQL-type data control provider.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
The following example demonstrates how to use the data_control_sql_insert() method:
  void
  sql_insert_response_cb(int request_id, data_control_h provider, long long inserted_row_id,
                         bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI("The insert operation is successful");
      else
          LOGI("The insert operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_sql_response_cb sql_callback;

  {
      int result = 0;
      int req_id = 0;
      bundle *b = NULL;

      sql_callback.insert_cb = sql_insert_response_cb;
      result = data_control_sql_register_response_cb(provider, &sql_callback, void *user_data);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);

          return result;
      }

      b = bundle_create();
      bundle_add(b, "WORD", "test");
      bundle_add(b, "WORD_DESC", "test description");

      result = data_control_sql_insert(provider, b, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Inserting is failed with error: %d", result);
      else
          LOGI("req_id is %d", req_id);

      bundle_free(b);

      return result;
  }
Parameters:
[in]providerThe provider handle
[in]insert_dataThe column-value pairs to insert
If the value is a string, then the value must be wrapped in single quotes, else it does not need to be wrapped in single quotes
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument
int data_control_sql_insert_bulk_data ( data_control_h  provider,
data_control_bulk_data_h  bulk_data,
int *  request_id 
)

Inserts multiple rows in one request.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this function, you must add privileges.
The following example demonstrates how to use the data_control_sql_insert_bulk_data() method:
  void
  sql_bulk_insert_response_cb(int request_id, data_control_h provider, data_control_bulk_result_data_h bulk_results,
      bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI("The bulk insert operation is successful");
      else
          LOGI("The bulk insert operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_sql_response_cb sql_callback;

  {
      data_control_bulk_data_h bulk_data;
      int req_id;
      bundle *b1;
      bundle *b2;
      int result = 0;
      int req_id = 0;
      int bulk_count = 0;

      result = data_control_sql_register_insert_bulk_data_response_cb(provider, sql_bulk_insert_response_cb, user_data);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);

          return result;
      }

      b1 = bundle_create();
      bundle_add_str(b1, "WORD", "'test'");
      bundle_add_str(b1, "WORD_DESC", "'test description'");
      b2 = bundle_create();
      bundle_add_str(b2, "WORD", "'test2'");
      bundle_add_str(b2, "WORD_DESC", "'test2 description'");

      data_control_bulk_data_create(&bulk_data);
      data_control_bulk_data_add(bulk_data, b1);
      data_control_bulk_data_add(bulk_data, b2);
      data_control_bulk_data_get_count(bulk_data, &bulk_count);

      dlog_print(DLOG_INFO, LOG_TAG, "bulk insert count %d ", bulk_count);

      data_control_sql_insert_bulk_data(provider, bulk_data, &req_id);
      data_control_bulk_data_destroy(bulk_data);

      bundle_free(b1);
      bundle_free(b2);

      return result;
  }
Parameters:
[in]providerThe provider handle
[in]bulk_dataThe bulk data handle
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument

Registers an insert bulk data callback for the SQL data control response. The application is notified when a data control response is received from the provider.

Since :
3.0
Remarks:
Only one callback can be registered for each provider id with this function. If you call this function multiple times for the same provider id, any previously set callback will be overwritten.
Parameters:
[in]providerThe provider handle
[in]callbackThe callback function to be called when a response is received
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_sql_unregister_insert_bulk_data_response_cb()
data_control_sql_bind_insert_bulk_data_response_cb()
int data_control_sql_register_response_cb ( data_control_h  provider,
data_control_sql_response_cb callback,
void *  user_data 
)

Registers a callback function for the SQL data control response.

Since :
2.3
Remarks:
The application is notified when a data control response is received from the provider.
Only one callback can be registered for each provider id with this API.
If you register multiple callback for same provider id, it will be overwritten by latest one.
Parameters:
[in]providerThe provider handle
[in]callbackThe callback function to be called when a response is received
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_sql_unregister_response_cb()
data_control_sql_bind_response_cb()
int data_control_sql_select ( data_control_h  provider,
char **  column_list,
int  column_count,
const char *  where,
const char *  order,
int *  request_id 
)

Selects the specified columns to be queried.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
The following example demonstrates how to use the data_control_sql_select() method:
  void
  sql_select_response_cb(int request_id, data_control_h provider, result_set_cursor *enumerator,
                         bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI("The select operation is successful");
      else
          LOGI("The select operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_sql_response_cb sql_callback;

  {
      int result = 0;
      int req_id = 0;
      char *column_list[2];
      column_list[0] = "WORD";
      column_list[1] = "WORD_DESC";
      const char *where = "WORD = 'test'";
      const char *order = "WORD ASC";

      sql_callback.select_cb = sql_select_response_cb;
      result = data_control_sql_register_response_cb(provider, &sql_callback, void *user_data);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);

          return result;
      }

      result = data_control_sql_select(provider, column_list, 2, where, order, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Selecting is failed with error: %d", result);
      else
          LOGI("req_id is %d", req_id);

      return result;
  }
Parameters:
[in]providerThe provider handle
[in]column_listThe column list to query
[in]column_countThe total number of columns to be queried
[in]whereA filter to select the desired rows
It is an SQL 'WHERE' clause excluding the 'WHERE' itself such as column1 = 'stringValue' and column2 = numericValue
[in]orderThe sorting order of the rows to query
It is an SQL 'ORDER BY' clause excluding the 'ORDER BY' itself.
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
int data_control_sql_select_with_page ( data_control_h  provider,
char **  column_list,
int  column_count,
const char *  where,
const char *  order,
int  page_number,
int  count_per_page,
int *  request_id 
)

Selects the specified columns to be queried, with partition into pages.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
Parameters:
[in]providerThe provider handle
[in]column_listThe column list to query
[in]column_countThe total number of columns to be queried
[in]whereA filter to select the desired rows
It is an SQL 'WHERE' clause excluding the 'WHERE' itself such as column1 = 'stringValue' and column2 = numericValue
[in]orderThe sorting order of the rows to query
It is an SQL 'ORDER BY' clause excluding the 'ORDER BY' itself
[in]page_numberThe page number of the result set
It starts from 1
[in]count_per_pageThe desired maximum count of rows on a page
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
See also:
data_control_sql_select()
int data_control_sql_set_data_id ( data_control_h  provider,
const char *  data_id 
)

Sets the data ID.

Since :
2.3
Parameters:
[in]providerThe provider handle
[in]data_idA string for identifying a specific table to operate
The string consists of one or more components separated by a slash('/')
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_sql_get_data_id()
  {
      bundle *b;
      int ret;

      // Insert data to Note table
      ret = data_control_sql_set_data_id(ad->provider_h, "Note");
      if (ret != DATA_CONTROL_ERROR_NONE)
          dlog_print(DLOG_ERROR, LOG_TAG, "setting data id failed with error: %d", ret);

      b = bundle_create();
      bundle_add_str(b, ""TITLE"", "test");
      bundle_add_str(b, "CONTENTS", "test contents");
      data_control_sql_insert(ad->provider_h, b, &req_id);
      bundle_free(b);

      // Insert data to Dictionary table
      ret = data_control_sql_set_data_id(ad->provider_h, "Dictionary");
      if (ret != DATA_CONTROL_ERROR_NONE)
          dlog_print(DLOG_ERROR, LOG_TAG, "setting data id failed with error: %d", ret);

      b = bundle_create();
      bundle_add_str(b, "WORD", "test");
      bundle_add_str(b, "WORD_DESC", "test desc");
      data_control_sql_insert(ad->provider_h, b, &req_id);
      bundle_free(b);
  }
int data_control_sql_set_provider_id ( data_control_h  provider,
const char *  provider_id 
)

Sets the Provider ID.

Since :
2.3
Parameters:
[in]providerThe provider handle
[in]provider_idThe data control provider ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
See also:
data_control_sql_get_provider_id()

Moves the cursor to the first position.

Since :
2.3
Remarks:
The following example demonstrates how to use the data_control_sql_step_first() method:
  void
  sql_select_response_cb(int request_id, data_control_h provider, result_set_cursor cursor,
                         bool provider_result, const char *error)
  {
      char person_name[32] = {0,};
      long long person_number = -1;

      data_control_sql_step_first(cursor);
      data_control_sql_get_text_data(cursor, 0, person_name);
      data_control_sql_get_int64_data(cursor, 1, &person_number);
      printf("The person %s has the number %l", person_name, person_number);
  }
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Moves the cursor to the last position.

Since :
2.3
Remarks:
The following example demonstrates how to use the data_control_sql_step_last() method:
  void
  sql_select_response_cb(int request_id, data_control_h provider, result_set_cursor cursor,
                         bool provider_result, const char *error)
  {
      char person_name[32] = {0,};
      long long person_number = -1;

      data_control_sql_step_last(cursor);
      data_control_sql_get_text_data(cursor, 0, person_name);
      data_control_sql_get_int64_data(cursor, 1, &person_number);
      printf("The person %s has the number %l", person_name, person_number);
  }
Parameters:
[in]cursorThe cursor that navigates the result of data control select request
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Moves the cursor to the next position.

Since :
2.3
Remarks:
The following example demonstrates how to use the data_control_sql_step_next() method:
  void
  sql_select_response_cb(int request_id, data_control_h provider, result_set_cursor cursor,
                         bool provider_result, const char *error)
  {
      char person_name[32] = {0,};
      long long person_number = -1;
      while (data_control_sql_step_next(cursor) == DATA_CONTROL_ERROR_NONE) {
          data_control_sql_get_text_data(cursor, 0, person_name);
          data_control_sql_get_int64_data(cursor, 1, &person_number);
          printf("The person %s has the number %l", person_name, person_number);
      }
  }
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Moves the cursor to the previous position.

Since :
2.3
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Unbinds the insert bulk data callback in the provider.

Since :
4.0
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_sql_unbind_insert_bulk_data_response_cb()

Unbinds the callback function in the provider.

Since :
4.0
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_sql_bind_response_cb()

Unregisters the insert bulk data callback.

Since :
3.0
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_sql_register_insert_bulk_data_response_cb()

Unregisters the callback function in the provider.

Since :
2.3
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
See also:
data_control_sql_register_response_cb()
int data_control_sql_update ( data_control_h  provider,
const bundle update_data,
const char *  where,
int *  request_id 
)

Updates values of a table owned by the SQL-type data control provider.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
http://tizen.org/privilege/appmanager.launch
Remarks:
If you want to use this api, you must add privileges.
The following example demonstrates how to use the data_control_sql_update() method:
  void
  sql_update_response_cb(int request_id, data_control_h provider, bool provider_result, const char *error, void *user_data)
  {
      if (provider_result)
          LOGI("The update operation is successful");
      else
          LOGI("The update operation for the request %d is failed. error message: %s", request_id, error);
  }

  data_control_sql_response_cb sql_callback;

  {
      int result = 0;
      int req_id = 0;
      const char *where = "WORD = 'test'";
      bundle *b = NULL;

      sql_callback.update_cb = sql_update_response_cb;
      result = data_control_sql_register_response_cb(provider, &sql_callback, void *user_data);
      if (result != DATA_CONTROL_ERROR_NONE) {
          LOGE("Registering the callback function is failed with error: %d", result);

          return result;
      }

      b = bundle_create();
      bundle_add(b, "WORD", "test_new");

      result = data_control_sql_update(provider, b, where, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE)
          LOGE("Updating is failed with error: %d", result);
      else
          LOGI("req_id is %d", req_id);

      bundle_free(b);

      return result;
  }
Parameters:
[in]providerThe provider handle
[in]update_dataThe column-value pairs to update
If the value is a string, the value must be wrapped in single quotes, else it does not need to be wrapped in single quotes
[in]whereA filter to select the desired rows to update
It is an SQL 'WHERE' clause excluding the 'WHERE' itself such as column1 = 'stringValue' and column2 = numericValue
[out]request_idThe request ID
Returns:
0 on success, otherwise a negative error value
Return values:
DATA_CONTROL_ERROR_NONESuccessful
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter
DATA_CONTROL_ERROR_IO_ERRORI/O error
DATA_CONTROL_ERROR_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_PERMISSION_DENIEDPermission denied
DATA_CONTROL_ERROR_MAX_EXCEEDEDToo long argument