Tizen Native API
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_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.
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_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.
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_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_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 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 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 from the key-value structured data control provider.
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_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 from the key-value structured data control provider.

Since :
2.3.1
Parameters:
[in]request_idThe request ID that identifies the data control
[in]providerThe provider handle
[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.1
Remarks:
You must release resule_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
[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 from the key-value structured data control provider.

Since :
2.3.1
Parameters:
[in]request_idThe request ID that identifies the data control
[in]providerThe provider handle
[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 from the key-value structured data control provider.

Since :
2.3.1
Parameters:
[in]request_idThe request ID that identifies the data control
[in]providerThe provider handle
[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.1
Parameters:
[in]request_idThe request ID that identifies 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_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.1
Parameters:
[in]request_idThe request ID
[in]providerThe provider handle
[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.1
Remarks:
enumerator will be removed after this callback is called.
Parameters:
[in]request_idThe request ID
[in]providerThe provider handle
[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.1
Parameters:
[in]request_idThe request ID
[in]providerThe provider handle
[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.1

Function Documentation

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.1
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) {
          dlog_print(DLOG_INFO, LOG_TAG, "The add operation is successful");
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "The add operation for the request %d is failed. error message: %s", request_id, error);
      }
  }

  data_control_map_response_cb map_callback;

  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Adding %s-%s pair is failed with error: %d", key, value, result);
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "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

Creates a provider handle.

Since :
2.3.1
Remarks:
The following example demonstrates how to use the data_control_map_create() method.
  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Destorying 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.1
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
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.1
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) {
          dlog_print(DLOG_INFO, LOG_TAG, "The get operation is successful");
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "The get operation for the request %d is failed. error message: %s", request_id, error);
      }
  }

  data_control_map_response_cb map_callback;

  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Getting the value list of the key(%s) is failed with error: %d", key, result);
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "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.1
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_provider_id ( data_control_h  provider,
char **  provider_id 
)

Gets the Provider ID.

Since :
2.3.1
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.

Since :
2.3.1
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. 1024 is the maximum value of count_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_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.1
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
See also:
data_control_map_unregister_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.1
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) {
          dlog_print(DLOG_INFO, LOG_TAG, "The remove operation is successful");
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "The remove operation for the request %d is failed. error message: %s", request_id, error);
     }
  }

  data_control_map_response_cb map_callback;

  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Removing %s-%s pair is failed with error: %d", key, value, result);
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "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.1
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) {
          dlog_print(DLOG_INFO, LOG_TAG, "The set operation is successful");
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "The set operation for the request %d is failed. error message: %s", request_id, error);
      }
  }

  data_control_map_response_cb map_callback;

  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Replacing old_value(%s) with new_value(%s) is failed with error: %d", old_value, new_value, result);
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "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.1
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.1
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()

Unregisters the callback function in the provider.

Since :
2.3.1
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value

Creates a provider handle.

Since :
2.3.1
Remarks:
The following example demonstrates how to use the data_control_sql_create() method:
  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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.1
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) {
          dlog_print(DLOG_INFO, LOG_TAG, The delete operation is successful");
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "The delete operation for the request %d is failed. error message: %s", request_id, error);
      }
  }

  data_control_sql_response_cb sql_callback;

  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Deleting is failed with error: %d", result);
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "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.1
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
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.1
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_MAX_EXCEEDEDToo long argument
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Gets the number of columns for this cursor.

Since :
2.3.1
Parameters:
[in]cursorThe cursor that navigates the result of the request for the select operation
Returns:
The number of columns in the calling cursor
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.1
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.1
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.1
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_INVALID_PARAMETERInvalid parameter
int data_control_sql_get_data_id ( data_control_h  provider,
char **  data_id 
)

Gets the data ID.

Since :
2.3.1
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.1
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_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.1
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.1
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.1
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.1
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.1
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) {
          dlog_print(DLOG_INFO, LOG_TAG, "The insert operation is successful");
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "The insert operation for the request %d is failed. error message: %s", request_id, error);
      }
  }

  data_control_sql_response_cb sql_callback;

  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Registering the callback function is failed with error: %d", result);
          return result;
      }

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

      result = data_control_sql_insert(provider, b, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Inserting is failed with error: %d", result);
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "req_id is %d", req_id);
      }

      bundle_free(b);
      return result;
  }
Parameters:
[in]providerThe provider handle
[in]insert_dataThe column-value pairs to insert\ n 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
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.1 remarks The application is notified when a data control response is received from the provider.
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
See also:
data_control_sql_unregister_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.1
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:
If more than 20 rows are selected, only first 20 rows are included in select result.
  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) {
          dlog_print(DLOG_INFO, LOG_TAG, "The select operation is successful");
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "The select operation for the request %d is failed. error message: %s", request_id, error);
      }
  }

  data_control_sql_response_cb sql_callback;

  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Selecting is failed with error: %d", result);
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "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.

Since :
2.3.1
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. 1024 is the maximum value of count_per_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.1
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()
int data_control_sql_set_provider_id ( data_control_h  provider,
const char *  provider_id 
)

Sets the Provider ID.

Since :
2.3.1
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.1
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_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Moves the cursor to the last position.

Since :
2.3.1
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_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Moves the cursor to the next position.

Since :
2.3.1
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_OUT_OF_MEMORYOut of memory
DATA_CONTROL_ERROR_INVALID_PARAMETERInvalid parameter

Moves the cursor to the previous position.

Since :
2.3.1
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

Unregisters the callback function in the provider.

Since :
2.3.1
Parameters:
[in]providerThe provider handle
Returns:
0 on success, otherwise a negative error value
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.1
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) {
          dlog_print(DLOG_INFO, LOG_TAG, "The update operation is successful");
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "The update operation for the request %d is failed. error message: %s", request_id, error);
      }
  }

  data_control_sql_response_cb sql_callback;

  int main()
  {
      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) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Registering the callback function is failed with error: %d", result);
          return result;
      }

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

      result = data_control_sql_update(provider, b, where, &req_id);
      if (result != DATA_CONTROL_ERROR_NONE) {
          dlog_print(DLOG_ERROR, LOG_TAG, "Updating is failed with error: %d", result);
      }
      else {
          dlog_print(DLOG_INFO, LOG_TAG, "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