Tizen Native API
3.0
|
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().
- Map type data control If you specify datacontrol_h using the data_control_map_create(), data_control_map_set_provider_id(), or data_control_map_set_data_id() method, you can get the specific map-type data control uniquely. After resolving the data control, call data_control_map APIs, such as data_control_map_set(), data_control_map_get(), data_control_map_add(), and data_control_map_remove(). The result is returned by response callback, such as data_control_map_get_response_cb(), data_control_map_set_response_cb(), data_control_map_add_response_cb() or data_control_map_remove_response_cb() of the data_control_map_response_cb struct. The response callback is invoked when a service application finishes its operation.
- SQL type data control If you specify the datacontrol_h using the data_control_sql_create(), data_control_sql_set_provider_id(), or data_control_sql_set_data_id() method, you can get the specific SQL-type data control uniquely. After resolving the data control, call data_control_sql APIs, such as data_control_sql_select(), data_control_sql_insert(), data_control_sql_update(), and data_control_sql_delete(). The result is returned by response callback, such as data_control_sql_select_response_cb(), data_control_sql_insert_response_cb(), data_control_sql_update_response_cb() or data_control_sql_delete_response_cb() of the data_control_sql_response_cb struct. The response callback is invoked when a service application finishes its operation. Once you get result_set_cursor using data_control_sql_select_response_cb(), then you can use following functions to get the information:
- data_control_sql_step_first()
- data_control_sql_step_last()
- data_control_sql_step_next()
- data_control_sql_step_previous()
- data_control_sql_get_column_count()
- data_control_sql_get_column_name()
- data_control_sql_get_column_item_size()
- data_control_sql_get_column_item_type()
- data_control_sql_get_blob_data()
- data_control_sql_get_int_data()
- data_control_sql_get_int64_data()
- data_control_sql_get_double_data()
- data_control_sql_get_text_data() Note: All callbacks are called in the main loop context, unless stated otherwise.
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. | |
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. | |
int | data_control_map_unregister_add_bulk_data_response_cb (data_control_h provider) |
Unregisters the add bulk data callback. | |
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. | |
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. | |
int | data_control_sql_unregister_insert_bulk_data_response_cb (data_control_h provider) |
Unregisters the insert bulk data callback. | |
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 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_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] provider The provider handle. provider is valid only inside this function
provider should not be freed[in] result Add data change callback result [in] callback_id Added callback ID [in] user_data The 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_id The request ID [in] provider The provider handle. provider is valid only inside this function.
provider should not be freed.[in] bulk_results The result data for each insert request. bulk_results is valid only inside this function.
bulk_results should not be freed.[in] provider_result Set to true
if the data control provider successfully processed,
otherwise set tofalse
[in] error The error message from the data control provider. error is valid only inside this function.
error should not be freed.[in] user_data The user data passed from the register function
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] provider The provider handle. provider is valid only inside this function
provider should not be freed[in] type Changed data type [in] data Data 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_data The 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.
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
- Parameters:
-
[in] request_id The request ID that identifies the data control [in] provider The provider handle [in] provider_result Set to true
if the data control provider successfully processed,
otherwise set tofalse
[in] error The error message from the data control provider [in] user_data The 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 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_id The request ID [in] provider The provider handle [in] result_value_list The result value list of the data control request that gets the matching values [in] result_value_count The number of the values [in] provider_result Set to true
if the data control provider is successfully processed,
otherwise set tofalse
[in] error The error message from the data control provider [in] user_data The 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
- Parameters:
-
[in] request_id The request ID that identifies the data control [in] provider The provider handle [in] provider_result Set to true
if the data control provider successfully processed,
otherwise set tofalse
[in] error The error message from the data control provider [in] user_data The 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
- Parameters:
-
[in] request_id The request ID that identifies the data control [in] provider The provider handle [in] provider_result Set to true
if the data control provider successfully processed,
otherwisefalse
[in] error The error message from the data control provider [in] user_data The 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_id The request ID that identifies the data control [in] provider_result Set to true
if the data control provider successfully processed,
otherwise set tofalse
[in] error The error message from the data control provider [in] user_data The 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_id The request ID [in] provider The provider handle [in] inserted_row_id The inserted row ID set by the data control [in] provider_result Set to true
if the data control provider successfully processed,
otherwise set tofalse
[in] error The error message from the data control provider [in] user_data The 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 this callback is called.
- Parameters:
-
[in] request_id The request ID [in] provider The provider handle [in] enumerator The enumerator for navigating the result of data control select request [in] provider_result Set to true
if the data control provider successfully processed,
otherwise set tofalse
[in] error The error message from the data control provider [in] user_data The 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_id The request ID [in] provider The provider handle [in] provider_result Set to true
if the data control provider successfully processed,
otherwise set tofalse
[in] error The error message from the data control provider [in] user_data The 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] provider Target provider handle [in] callback The callback function to be called when consumer receives data change notification [in] user_data The user data to be passed to the callback function [in] result_callback The callback function to be called when consumer receives add data change callback process result [in] result_cb_user_data The user data to be passed to the result_callback function [out] callback_id Added callback ID, it can be used to remove the callback
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_PERMISSION_DENIED Permission denied
int data_control_bulk_data_add | ( | data_control_bulk_data_h | bulk_data, |
bundle * | data | ||
) |
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_data The bulk data handle [in] data The bundle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_bulk_data_create | ( | data_control_bulk_data_h * | bulk_data | ) |
Creates bulk data.
- Since :
- 3.0
- Remarks:
- The bulk_data should be released using data_control_bulk_data_destroy().
- Parameters:
-
[out] bulk_data The bulk data handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_bulk_data_destroy | ( | data_control_bulk_data_h | bulk_data | ) |
Destroys bulk data.
- Since :
- 3.0
- Parameters:
-
[in] bulk_data The bulk data handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid 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_data The bulk data handle [out] count The bundle count
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid 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_data The bulk data handle [in] idx The bundle index. Index starts at 0 [out] data The n-th bundle.
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
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_data The bulk result data handle [in] data The bundle [in] result Bulk 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_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_bulk_result_data_create | ( | data_control_bulk_result_data_h * | 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_data The bulk result data handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_bulk_result_data_destroy | ( | data_control_bulk_result_data_h | result_data | ) |
Destroys bulk result data.
- Since :
- 3.0
- Parameters:
-
[in] result_data The bulk result data handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
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.
- Since :
- 3.0
- Parameters:
-
[in] result_data The bulk result data handle [out] count The bundle count
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid 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_data The bulk result data handle [in] idx The bundle index. Index starts at 0 [out] data The n-th bundle [out] result Bulk 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_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
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] provider The provider handle [in] key The key of the value to add [in] value The value to add [out] request_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_MAX_EXCEEDED Too long argument DATA_CONTROL_ERROR_PERMISSION_DENIED Permission 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] provider The provider handle [in] bulk_data The bulk data handle [out] request_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_MAX_EXCEEDED Too long argument. Bulk data total length cannot exceed 1MB DATA_CONTROL_ERROR_PERMISSION_DENIED Permission denied
int data_control_map_create | ( | data_control_h * | provider | ) |
Creates a provider handle.
- Since :
- 2.3
- Remarks:
- 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("Destorying data control provider is failed with error: %d", result); return result; }
- Parameters:
-
[out] provider The provider handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- See also:
- data_control_map_destroy()
int data_control_map_destroy | ( | data_control_h | provider | ) |
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] provider The 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
- 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] provider The provider handle [in] key The key of the value list to obtain [out] request_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_MAX_EXCEEDED Too long argument DATA_CONTROL_ERROR_PERMISSION_DENIED Permission 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] provider The provider handle [out] data_id A 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_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out 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
- Remarks:
- You must release provider_id using free() after it is used.
- Parameters:
-
[in] provider The provider handle [out] provider_id The data control provider ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out 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
- 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] provider The provider handle [in] key The key of the value list to obtain [out] request_id The request ID [in] page_number The page number of the value set
It starts from1
.[in] count_per_page The desired maximum count of the data items per page
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_MAX_EXCEEDED Too long argument DATA_CONTROL_ERROR_PERMISSION_DENIED Permission 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.
- Since :
- 3.0
- Remarks:
- The application is notified when a data control response is received from the provider.
- Parameters:
-
[in] provider The provider handle [in] callback The callback function to be called when a response is received [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
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] provider The provider handle [in] callback The callback function to be called when a response is received [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
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] provider The provider handle [in] key The key of the value to remove [in] value The value to remove [out] request_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_MAX_EXCEEDED Too long argument DATA_CONTROL_ERROR_PERMISSION_DENIED Permission 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] provider The provider handle [in] key The key of the value to replace [in] old_value The value to replace [in] new_value The new value that replaces the existing value [out] request_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_MAX_EXCEEDED Too long argument DATA_CONTROL_ERROR_PERMISSION_DENIED Permission 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] provider The provider handle [in] data_id A 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_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out 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] provider The provider handle [in] provider_id The data control provider ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- See also:
- data_control_map_get_provider_id()
int data_control_map_unregister_add_bulk_data_response_cb | ( | data_control_h | provider | ) |
Unregisters the add bulk data callback.
- Since :
- 3.0
- Parameters:
-
[in] provider The provider handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_map_unregister_response_cb | ( | data_control_h | provider | ) |
Unregisters the callback function in the provider.
- Since :
- 2.3
- Parameters:
-
[in] provider The provider handle
- Returns:
0
on success, otherwise a negative error value
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] provider Target provider handle [in] callback_id Target callback ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_PERMISSION_DENIED Permission denied
int data_control_sql_create | ( | data_control_h * | provider | ) |
Creates a provider handle.
- Since :
- 2.3
- Remarks:
- 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] provider The provider handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out 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] provider The provider handle [in] where A 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_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_PERMISSION_DENIED Permission denied
int data_control_sql_destroy | ( | data_control_h | provider | ) |
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] provider The 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
- Parameters:
-
[in] cursor The cursor that navigates the result of the request for the select operation [in] column_index The index of the destination column [out] data The blob value obtained from the column [out] size The size of the data
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_MAX_EXCEEDED Too long argument DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_sql_get_column_count | ( | result_set_cursor | cursor | ) |
Gets the number of columns for this cursor.
- Since :
- 2.3
- Parameters:
-
[in] cursor The 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
- Parameters:
-
[in] cursor The cursor that navigates the result of the request for the select operation [in] column_index The 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_ERROR I/O error DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
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.
- Since :
- 2.3
- Parameters:
-
[in] cursor The cursor that navigates the result of the request for the select operation [in] column_index The index of the destination column [out] type The type of the destination column
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid 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] cursor The cursor that navigates the result of the request for the select operation [in] column_index The index of the destination column [out] name The 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_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid 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] provider The provider handle [out] data_id A 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_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out 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] cursor The cursor that navigates the result of the request for the select operation [in] column_index The index of the destination column [out] data The value obtained from the column as double
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid 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] cursor The cursor that navigates the result of the request for the select operation [in] column_index The index of the destination column [out] data The 64-bit integer value obtained from the column
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid 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] cursor The cursor that navigates the result of the request for the select operation [in] column_index The index of the destination column [out] data The integer value obtained from the column
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid 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] provider The provider handle [out] provider_id The data control provider ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out 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] cursor The cursor that navigates the result of the request for the select operation [in] column_index The index of the destination column [out] data The 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_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out 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] provider The provider handle [in] insert_data The 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_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_PERMISSION_DENIED Permission denied
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] provider The provider handle [in] bulk_data The bulk data handle [out] request_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_PERMISSION_DENIED Permission denied
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.
- Since :
- 3.0
remarks The application is notified when a data control response is received from the provider.
- Parameters:
-
[in] provider The provider handle [in] callback The callback function to be called when a response is received [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
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] provider The provider handle [in] callback The callback function to be called when a response is received [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
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] provider The provider handle [in] column_list The column list to query [in] column_count The total number of columns to be queried [in] where A filter to select the desired rows
It is an SQL 'WHERE' clause excluding the 'WHERE' itself such as column1 = 'stringValue' and column2 = numericValue[in] order The sorting order of the rows to query
It is an SQL 'ORDER BY' clause excluding the 'ORDER BY' itself.[out] request_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_PERMISSION_DENIED Permission 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
- 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] provider The provider handle [in] column_list The column list to query [in] column_count The total number of columns to be queried [in] where A filter to select the desired rows
It is an SQL 'WHERE' clause excluding the 'WHERE' itself such as column1 = 'stringValue' and column2 = numericValue[in] order The sorting order of the rows to query
It is an SQL 'ORDER BY' clause excluding the 'ORDER BY' itself[in] page_number The page number of the result set
It starts from1
[in] count_per_page The desired maximum count of rows on a page [out] request_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_PERMISSION_DENIED Permission 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] provider The provider handle [in] data_id A 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_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out 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] provider The provider handle [in] provider_id The data control provider ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory
- See also:
- data_control_sql_get_provider_id()
int data_control_sql_step_first | ( | result_set_cursor | cursor | ) |
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] cursor The 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_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_sql_step_last | ( | result_set_cursor | cursor | ) |
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] cursor The cursor that navigates the result of data control select request
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_sql_step_next | ( | result_set_cursor | cursor | ) |
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] cursor The 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_NONE Successful DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_sql_step_previous | ( | result_set_cursor | cursor | ) |
Moves the cursor to the previous position.
- Since :
- 2.3
- Parameters:
-
[in] cursor The 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_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
Unregisters the insert bulk data callback.
- Since :
- 3.0
- Parameters:
-
[in] provider The provider handle
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_sql_unregister_response_cb | ( | data_control_h | provider | ) |
Unregisters the callback function in the provider.
- Since :
- 2.3
- Parameters:
-
[in] provider The 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
- 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] provider The provider handle [in] update_data The 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] where A 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_id The request ID
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
DATA_CONTROL_ERROR_NONE Successful DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_IO_ERROR I/O error DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_PERMISSION_DENIED Permission denied