Tizen Native API
|
Service applications can provide their own data.
Required Header
#include <data_control.h>
Overview
The service application providing its own database file must register the provider callback using data_control_provider_sql_register_cb(). The service application providing its own registry file or key-value pairs data set must register the provider callback using the data_control_provider_map_register_cb(). The service application sends SQL-type or Map-type data control result to the other application, by using methods such as data_control_provider_send_select_result(),data_control_provider_send_insert_result(), data_control_provider_send_update_result(), or data_control_provider_send_delete_result().
Functions | |
int | data_control_provider_sql_register_cb (data_control_provider_sql_cb *callback, void *user_data) |
Registers a callback function for the SQL data control request. The provider is notified when a data control request is received from the client applications. | |
int | data_control_provider_sql_unregister_cb (void) |
Unregisters the callback functions. | |
int | data_control_provider_map_register_cb (data_control_provider_map_cb *callback, void *user_data) |
Registers a callback function for the map data control request. The provider is notified when a data control request is received from the client applications. | |
int | data_control_provider_map_unregister_cb (void) |
Unregisters the callback functions. | |
int | data_control_provider_get_client_appid (int request_id, char **appid) |
Gets the application ID which sends the data control request. | |
int | data_control_provider_send_select_result (int request_id, void *db_handle) |
Sends the success result and the result set of the select request to the client application. | |
int | data_control_provider_send_insert_result (int request_id, long long row_id) |
Sends the success result of the insert request and the last inserted row ID to the client application. | |
int | data_control_provider_send_update_result (int request_id) |
Sends the success result of the update request to the client application. | |
int | data_control_provider_send_delete_result (int request_id) |
Sends the success result of the delete request to the client application. | |
int | data_control_provider_send_error (int request_id, const char *error) |
Sends the provider error message to the client application. | |
int | data_control_provider_send_map_result (int request_id) |
Sends the success result of the request for setting, adding and removing the key-value structured data the client application. | |
int | data_control_provider_send_map_get_value_result (int request_id, char **value_list, int value_count) |
Sends the success result of the request for getting the value list to the client application. | |
char * | data_control_provider_create_insert_statement (data_control_h provider, bundle *insert_map) |
Creates SQL INSERT statement. | |
char * | data_control_provider_create_delete_statement (data_control_h provider, const char *where) |
Creates SQL DELETE statement. | |
char * | data_control_provider_create_update_statement (data_control_h provider, bundle *update_map, const char *where) |
Creates SQL UPDATE statement. | |
char * | data_control_provider_create_select_statement (data_control_h provider, const char **column_list, int column_count, const char *where, const char *order) |
Creates SQL SELECT statement. | |
bool | data_control_provider_match_provider_id (data_control_h provider, const char *provider_id) |
Checks whether the given provider ID matches the provider handle's provider ID. | |
bool | data_control_provider_match_data_id (data_control_h provider, const char *data_id) |
Checks whether the given data ID matches the provider handle's data ID. | |
Typedefs | |
typedef void(* | data_control_provider_sql_insert_request_cb )(int request_id, data_control_h provider, bundle *insert_data, void *user_data) |
Called when the insert request is received from an application using SQL-friendly interface based data control. | |
typedef void(* | data_control_provider_sql_update_request_cb )(int request_id, data_control_h provider, bundle *update_data, const char *where, void *user_data) |
Called when the update request is received from an application using SQL-friendly interface based data control. | |
typedef void(* | data_control_provider_sql_delete_request_cb )(int request_id, data_control_h provider, const char *where, void *user_data) |
Called when the delete request is received from an application using SQL-friendly interface based data control. | |
typedef void(* | data_control_provider_sql_select_request_cb )(int request_id, data_control_h provider, const char **column_list, int column_count, const char *where, const char *order, void *user_data) |
Called when the select request is received from an application using SQL-friendly interface based data control. | |
typedef void(* | data_control_provider_map_get_value_request_cb )(int request_id, data_control_h provider, const char *key, void *user_data) |
Called when the request for obtaining the value list is received from the key-value structured data control consumer. | |
typedef void(* | data_control_provider_map_set_value_request_cb )(int request_id, data_control_h provider, const char *key, const char *old_value, const char *new_value, void *user_data) |
Called when the request for replacing the value is received from the key-value structured data control consumer. | |
typedef void(* | data_control_provider_map_add_value_request_cb )(int request_id, data_control_h provider, const char *key, const char *value, void *user_data) |
Called when the request for adding the value is received from the key-value structured data control consumer. | |
typedef void(* | data_control_provider_map_remove_value_request_cb )(int request_id, data_control_h provider, const char *key, const char *value, void *user_data) |
Called when the request for removing the value is received from the key-value structured data control consumer. |
Typedef Documentation
typedef void(* data_control_provider_map_add_value_request_cb)(int request_id, data_control_h provider, const char *key, const char *value, void *user_data) |
Called when the request for adding the value is received from the key-value structured data control consumer.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [in] provider The provider handle [in] key The key of the value to add [in] value The value to add [in] user_data The user data passed from the register function
typedef void(* data_control_provider_map_get_value_request_cb)(int request_id, data_control_h provider, const char *key, void *user_data) |
Called when the request for obtaining the value list is received from the key-value structured data control consumer.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [in] provider The provider handle [in] key The key of the value list to obtain [in] user_data The user data passed from the register function
typedef void(* data_control_provider_map_remove_value_request_cb)(int request_id, data_control_h provider, const char *key, const char *value, void *user_data) |
Called when the request for removing the value is received from the key-value structured data control consumer.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [in] provider The provider handle [in] key The key of the value to remove [in] value The value to remove [in] user_data The user data passed from the register function
typedef void(* data_control_provider_map_set_value_request_cb)(int request_id, data_control_h provider, const char *key, const char *old_value, const char *new_value, void *user_data) |
Called when the request for replacing the value is received from the key-value structured data control consumer.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [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 [in] user_data The user data passed from the register function
typedef void(* data_control_provider_sql_delete_request_cb)(int request_id, data_control_h provider, const char *where, void *user_data) |
Called when the delete request is received from an application using SQL-friendly interface based data control.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [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.[in] user_data The user data passed from the register function
typedef void(* data_control_provider_sql_insert_request_cb)(int request_id, data_control_h provider, bundle *insert_data, void *user_data) |
Called when the insert request is received from an application using SQL-friendly interface based data control.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [in] provider The provider handle [in] insert_data The column-value pairs to insert
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] user_data The user data passed from the register function
typedef void(* data_control_provider_sql_select_request_cb)(int request_id, data_control_h provider, const char **column_list, int column_count, const char *where, const char *order, void *user_data) |
Called when the select request is received from an application using SQL-friendly interface based data control.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [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] user_data The user data passed from the register function
typedef void(* data_control_provider_sql_update_request_cb)(int request_id, data_control_h provider, bundle *update_data, const char *where, void *user_data) |
Called when the update request is received from an application using SQL-friendly interface based data control.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [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.[in] user_data The user data passed from the register function
Function Documentation
char* data_control_provider_create_delete_statement | ( | data_control_h | provider, |
const char * | where | ||
) |
Creates SQL DELETE statement.
- Remarks:
- The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- Since :
- 2.3.1
- Parameters:
-
[in] provider The provider handle [in] where A filter to select the desired rows to delete
PassNULL
if all rows need to be deleted.
- Returns:
- The SQL DELETE statement on success, otherwise NULL
- Exceptions:
-
DATA_CONTROL_ERROR_NONE Success DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
char* data_control_provider_create_insert_statement | ( | data_control_h | provider, |
bundle * | insert_map | ||
) |
Creates SQL INSERT statement.
- Remarks:
- The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- Since :
- 2.3.1
- Parameters:
-
[in] provider The provider handle [in] insert_map The column-value pairs to insert
- Returns:
- The SQL INSERT statement on success, otherwise NULL
- Exceptions:
-
DATA_CONTROL_ERROR_NONE Success DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
char* data_control_provider_create_select_statement | ( | data_control_h | provider, |
const char ** | column_list, | ||
int | column_count, | ||
const char * | where, | ||
const char * | order | ||
) |
Creates SQL SELECT statement.
- Remarks:
- The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- Since :
- 2.3.1
- Parameters:
-
[in] provider The provider handle [in] column_list The column names to query
PassNULL
if all columns need to be selected.[in] column_count The total number of columns to be queried [in] where A filter to select the desired rows [in] order The sorting order of rows to query
- Returns:
- The SQL SELECT statement on success, otherwise NULL
- Exceptions:
-
DATA_CONTROL_ERROR_NONE Success DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
char* data_control_provider_create_update_statement | ( | data_control_h | provider, |
bundle * | update_map, | ||
const char * | where | ||
) |
Creates SQL UPDATE statement.
- Remarks:
- The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- Since :
- 2.3.1
- Parameters:
-
[in] provider The provider handle [in] update_map The column-value pairs to update [in] where A filter to select the desired rows to update
- Returns:
- The SQL UPDATE statement on success, otherwise NULL
- Exceptions:
-
DATA_CONTROL_ERROR_NONE Success DATA_CONTROL_ERROR_OUT_OF_MEMORY Out of memory DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_provider_get_client_appid | ( | int | request_id, |
char ** | appid | ||
) |
Gets the application ID which sends the data control request.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [out] appid The application ID
- 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_provider_map_register_cb | ( | data_control_provider_map_cb * | callback, |
void * | user_data | ||
) |
Registers a callback function for the map data control request. The provider is notified when a data control request is received from the client applications.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/datasharing
- Parameters:
-
[in] callback The callback function to be called when a data control request 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_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_PERMISSION_DENIED Permission denied
int data_control_provider_map_unregister_cb | ( | void | ) |
Unregisters the callback functions.
- Since :
- 2.3.1
- Returns:
0
on success, otherwise a negative error value
bool data_control_provider_match_data_id | ( | data_control_h | provider, |
const char * | data_id | ||
) |
Checks whether the given data ID matches the provider handle's data ID.
- Remarks:
- The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- Since :
- 2.3.1
- Parameters:
-
[in] provider The provider handle [in] data_id The data ID to be compared with handle's data ID
- Returns:
true
if the data_id matches, otherwisefalse
if it does not match
- Exceptions:
-
DATA_CONTROL_ERROR_NONE Success DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
bool data_control_provider_match_provider_id | ( | data_control_h | provider, |
const char * | provider_id | ||
) |
Checks whether the given provider ID matches the provider handle's provider ID.
- Remarks:
- The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section.
- Since :
- 2.3.1
- Parameters:
-
[in] provider The provider handle [in] provider_id The provider ID to be compared with handle's provider ID
- Returns:
true
if the provider_id matches, otherwisefalse
if it does not match
- Exceptions:
-
DATA_CONTROL_ERROR_NONE Success DATA_CONTROL_ERROR_INVALID_PARAMETER Invalid parameter
int data_control_provider_send_delete_result | ( | int | request_id | ) |
Sends the success result of the delete request to the client application.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request 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_INVALID_PARAMETER Invalid parameter
int data_control_provider_send_error | ( | int | request_id, |
const char * | error | ||
) |
Sends the provider error message to the client application.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [in] error The provider-defined error message
- 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_provider_send_insert_result | ( | int | request_id, |
long long | row_id | ||
) |
Sends the success result of the insert request and the last inserted row ID to the client application.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [in] row_id The row ID of the database changed by the insert 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_INVALID_PARAMETER Invalid parameter
int data_control_provider_send_map_get_value_result | ( | int | request_id, |
char ** | value_list, | ||
int | value_count | ||
) |
Sends the success result of the request for getting the value list to the client application.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [in] value_list The result value list [in] value_count The number of the values
- 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_PERMISSION_DENIED Permission denied
int data_control_provider_send_map_result | ( | int | request_id | ) |
Sends the success result of the request for setting, adding and removing the key-value structured data the client application.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request 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_INVALID_PARAMETER Invalid parameter
int data_control_provider_send_select_result | ( | int | request_id, |
void * | db_handle | ||
) |
Sends the success result and the result set of the select request to the client application.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request ID [in] db_handle The result DB handle for the result set
- 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_PERMISSION_DENIED Permission denied
int data_control_provider_send_update_result | ( | int | request_id | ) |
Sends the success result of the update request to the client application.
- Since :
- 2.3.1
- Parameters:
-
[in] request_id The request 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_INVALID_PARAMETER Invalid parameter
int data_control_provider_sql_register_cb | ( | data_control_provider_sql_cb * | callback, |
void * | user_data | ||
) |
Registers a callback function for the SQL data control request. The provider is notified when a data control request is received from the client applications.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/datasharing
- Parameters:
-
[in] callback The callback function to be called when a data control request 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_INVALID_PARAMETER Invalid parameter DATA_CONTROL_ERROR_PERMISSION_DENIED Permission denied
int data_control_provider_sql_unregister_cb | ( | void | ) |
Unregisters the callback functions.
- Since :
- 2.3.1
- Returns:
0
on success, otherwise a negative error value