The DataControl functionality provides a way to access specific data that is exported by other applications.
Please read the Native DataControl API to know how to share own application data with other applications.
Since: 2.1
Interface | Method |
---|---|
DataControlManagerObject | |
DataControlManager | DataControlConsumerObject getDataControlConsumer (DOMString providerId, DOMString dataId, DataType type) |
DataControlConsumerObject | |
SQLDataControlConsumer | void insert (unsigned long reqId, RowData insertionData, optional DataControlInsertSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) void update (unsigned long reqId, RowData updateData, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) void remove (unsigned long reqId, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) void select (unsigned long reqId, DOMString[] columns, DOMString where, DataControlSelectSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback, optional unsigned long? page, optional unsigned long? maxNumberPerPage) |
MappedDataControlConsumer | void addValue (unsigned long reqId, DOMString key, DOMString value, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) void removeValue (unsigned long reqId, DOMString key, DOMString value, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback) void getValue (unsigned long reqId, DOMString key, DataControlGetValueSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback) void updateValue (unsigned long reqId, DOMString key, DOMString oldValue, DOMString newValue, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback) |
DataControlSuccessCallback | void onsuccess (unsigned long reqId) |
DataControlErrorCallback | void onerror (unsigned long reqId, WebAPIError error) |
DataControlInsertSuccessCallback | void onsuccess (unsigned long reqId, long insertRowId) |
DataControlSelectSuccessCallback | void onsuccess (RowData[] rows, unsigned long reqId) |
DataControlGetValueSuccessCallback | void onsuccess (DOMString[] values, unsigned long reqid) |
RowData |
[NoInterfaceObject] interface DataControlManagerObject { readonly attribute DataControlManager datacontrol; };
Tizen implements DataControlManagerObject;
Since: 2.1
The tizen.datacontrol object allows access to the DataControl API.
[NoInterfaceObject] interface DataControlManager { DataControlConsumerObject getDataControlConsumer(DOMString providerId, DOMString dataId, DataType type) raises(WebAPIException); };
Since: 2.1
getDataControlConsumer
DataControlConsumerObject getDataControlConsumer(DOMString providerId, DOMString dataId, DataType type);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datacontrol.consumer
Parameters:
Return value:
DataControlConsumerObject The local DataControlConsumerObject.Exceptions:
with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
//The data provider, a native application, should be pre-installed and launched. //The same provider ID should be defined for the use of this API between a native application(provider) and a web application(consumer). //In this example, the DictionaryDataControlProvider native sample application is used as a data control provider. //Gets SQL type DataControlConsumerObject try { var globalSQLConsumer = tizen.datacontrol.getDataControlConsumer( "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "SQL"); } catch (err) { console.log (err.name +": " + err.message); } // Gets MAP type DataControlConsumerObject try { globalMappedConsumer = tizen.datacontrol.getDataControlConsumer( "http://tizen.org/datacontrol/provider/DictionaryDataControlProvider", "Dictionary", "MAP"); } catch (err) { console.log (err.name +": " + err.message); }
[NoInterfaceObject] interface DataControlConsumerObject { readonly attribute DataType type; readonly attribute DOMString providerId; readonly attribute DOMString dataId; };
Since: 2.1
Since: 2.1
Since: 2.1
Since: 2.1
[NoInterfaceObject] interface SQLDataControlConsumer : DataControlConsumerObject { void insert(unsigned long reqId, RowData insertionData, optional DataControlInsertSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void update(unsigned long reqId, RowData updateData, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void remove(unsigned long reqId, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void select(unsigned long reqId, DOMString[] columns, DOMString where, DataControlSelectSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback, optional unsigned long? page, optional unsigned long? maxNumberPerPage) raises(WebAPIException); };
Since: 2.1
insert
void insert(unsigned long reqId, RowData insertionData, optional DataControlInsertSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datacontrol.consumer
Parameters:
Exceptions:
with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if the passed parameter is not available on the data provider side or platform or if an SQL query with invalid parameters has been made.
with error type IOError, if a DB operation has failed.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
function successcb(id, insertRowId) { console.log("ok : reqid " + id); } function errorcb(id, error) { console.log("error id : " + id + ", error msg : " + error.message); } try { var rowData = { columns : ["WORD", "WORD_DESC"] , values : ["'tizen1'", "'tizen2'"] }; // Defines globalReqId before // Increases globalReqId for uniqueness globalReqId++; globalSQLConsumer.insert(globalReqId, rowData, successcb, errorcb); } catch (err) { console.log (err.name +": " + err.message); }
update
void update(unsigned long reqId, RowData updateData, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datacontrol.consumer
Parameters:
Exceptions:
with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if the passed parameter is not available on the data provider side or platform or if an SQL query with invalid parameters has been made.
with error type IOError, if a DB operation has failed.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
function successcb(id) { console.log("ok : reqid " + id); } function errorcb(id, error) { console.log("error id : " + id + ", error msg : " + error.message); } try { var rowData = { columns : ["WORD", "WORD_DESC"] , values : ["'tizen1'", "'Web apps platform!'"] }; // Defines globalReqId before // Increases globalReqId for uniqueness globalReqId++; globalSQLConsumer.update(globalReqId, rowData, "WORD='tizen1'", successcb, errorcb); } catch (err) { console.log (err.name +": " + err.message); }
remove
void remove(unsigned long reqId, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datacontrol.consumer
Parameters:
Exceptions:
with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if the passed parameter is not available on the data provider side or platform or if an SQL query with invalid parameters has been made.
with error type IOError, if a DB operation has failed.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
function successcb(id) { console.log("ok : reqid " + id); } function errorcb(id, error) { console.log("error id : " + id + ", error msg : " + error.message); } try { // Defines globalReqId before // Increases globalReqId for uniqueness globalReqId++; globalSQLConsumer.remove(globalReqId, "WORD='tizen1'", successcb, errorcb); } catch (err) { console.log (err.name +": " + err.message); }
select
void select(unsigned long reqId, DOMString[] columns, DOMString where, DataControlSelectSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback, optional unsigned long? page, optional unsigned long? maxNumberPerPage);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datacontrol.consumer
Parameters:
Exceptions:
with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if the passed parameter is not available on the data provider side or platform or if an SQL query with invalid parameters has been made.
with error type IOError, if a DB operation has failed.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
function getValueSuccessCB(result, id) { var length = result.length; for (var i = 0; i < length; i++) { var j = 0; for (j = 0; j < result[i].columns.length; j++) { console.log("column: " + result[i].columns[j] + ", value: " + result[i].values[j]); } } } function errorcb(id, error) { console.log("error id : " + id + ", error msg : " + error.message); } try { // Defines globalReqId before // Increases globalReqId for uniqueness var array = ["WORD", "WORD_DESC" ]; globalReqId++; globalSQLConsumer.select(globalReqId, array, "WORD='tizen1'", getValueSuccessCB, errorcb); } catch (err) { console.log (err.name +": " + err.message); }
[NoInterfaceObject] interface MappedDataControlConsumer : DataControlConsumerObject { void addValue(unsigned long reqId, DOMString key, DOMString value, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void removeValue(unsigned long reqId, DOMString key, DOMString value, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void getValue(unsigned long reqId, DOMString key, DataControlGetValueSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void updateValue(unsigned long reqId, DOMString key, DOMString oldValue, DOMString newValue, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); };
Since: 2.1
addValue
void addValue(unsigned long reqId, DOMString key, DOMString value, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datacontrol.consumer
Parameters:
Exceptions:
with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if the passed parameter is not available on the data provider side or platform.
with error type IOError, if a DB operation has failed.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
function successcb(id) { console.log("ok : reqid " + id); } function errorcb(id, error) { console.log("error id : " + id + ", error msg : " + error.message); } try { // Defines globalReqId before // Increases globalReqId for uniqueness globalReqId++; globalMappedConsumer.addValue(globalReqId, "tizen", "Foo", successcb, errorcb); } catch (err) { console.log (err.name +": " + err.message); }
removeValue
void removeValue(unsigned long reqId, DOMString key, DOMString value, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datacontrol.consumer
Parameters:
Exceptions:
with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if the passed parameter is not available on the data provider side or platform.
with error type IOError, if a DB operation has failed.
with error type NotFoundError, if the key cannot be found.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
function successcb(id) { console.log("ok : reqid " + id); } function errorcb(id, error) { console.log("error id : " + id + ", error msg : " + error.message); } try { // Defines globalReqId before // Increases globalReqId for uniqueness globalReqId++; globalMappedConsumer.removeValue(globalReqId, "tizen", "Foo", successcb, errorcb); } catch (err) { console.log (err.name +": " + err.message); }
getValue
void getValue(unsigned long reqId, DOMString key, DataControlGetValueSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datacontrol.consumer
Parameters:
Exceptions:
with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if the passed parameter is not available on the data provider side or platform.
with error type IOError, if a DB operation has failed.
with error type NotFoundError, if the key cannot be found.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
function getValueSuccessCB(result, id) { console.log(result.length + ":" + result[0]); } function errorcb(id, error) { console.log("error id : " + id + ", error msg : " + error.message); } try { // Defines globalReqId before // Increases globalReqId for uniqueness globalReqId++; globalMappedConsumer.getValue(globalReqId, "tizen", getValueSuccessCB, errorcb); } catch (err) { console.log (err.name +": " + err.message); }
updateValue
void updateValue(unsigned long reqId, DOMString key, DOMString oldValue, DOMString newValue, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback);
Since: 2.1
Privilege level: public
Privilege: http://tizen.org/privilege/datacontrol.consumer
Parameters:
Exceptions:
with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.
with error type InvalidValuesError, if the passed parameter is not available on the data provider side or platform.
with error type IOError, if a DB operation has failed.
with error type NotFoundError, if the key cannot be found.
with error type SecurityError, if the application does not have the privilege to call this method.
with error type UnknownError, if any other error occurs.
Code example:
function successcb(id) { console.log("ok : reqid " + id); } function errorcb(id, error) { console.log("error id : " + id + ", error msg : " + error.message); } try { // Defines globalReqId before // Increases globalReqId for uniqueness globalReqId++; globalMappedConsumer.updateValue(globalReqId, "tizen", "Foo", "Bar", successcb, errorcb); } catch (err) { console.log (err.name +": " + err.message); }
[Callback=FunctionOnly, NoInterfaceObject] interface DataControlSuccessCallback { void onsuccess(unsigned long reqId); };
Since: 2.1
[Callback=FunctionOnly, NoInterfaceObject] interface DataControlErrorCallback { void onerror(unsigned long reqId, WebAPIError error); };
Since: 2.1
onerror
void onerror(unsigned long reqId, WebAPIError error);
Since: 2.1
Parameters:
[Callback=FunctionOnly, NoInterfaceObject] interface DataControlInsertSuccessCallback { void onsuccess(unsigned long reqId, long insertRowId); };
Since: 2.1
onsuccess
void onsuccess(unsigned long reqId, long insertRowId);
Since: 2.1
Parameters:
[Callback=FunctionOnly, NoInterfaceObject] interface DataControlSelectSuccessCallback { void onsuccess(RowData[] rows, unsigned long reqId); };
Since: 2.1
onsuccess
void onsuccess(RowData[] rows, unsigned long reqId);
Since: 2.1
Parameters:
[Callback=FunctionOnly, NoInterfaceObject] interface DataControlGetValueSuccessCallback { void onsuccess(DOMString[] values, unsigned long reqid); };
Since: 2.1
dictionary RowData { DOMString[] columns; DOMString[] values; };
Since: 2.1
Since: 2.1
Since: 2.1
module DataControl { enum DataType { "MAP", "SQL"}; [NoInterfaceObject] interface DataControlManagerObject { readonly attribute DataControlManager datacontrol; }; Tizen implements DataControlManagerObject; [NoInterfaceObject] interface DataControlManager { DataControlConsumerObject getDataControlConsumer(DOMString providerId, DOMString dataId, DataType type) raises(WebAPIException); }; [NoInterfaceObject] interface DataControlConsumerObject { readonly attribute DataType type; readonly attribute DOMString providerId; readonly attribute DOMString dataId; }; [NoInterfaceObject] interface SQLDataControlConsumer : DataControlConsumerObject { void insert(unsigned long reqId, RowData insertionData, optional DataControlInsertSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void update(unsigned long reqId, RowData updateData, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void remove(unsigned long reqId, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void select(unsigned long reqId, DOMString[] columns, DOMString where, DataControlSelectSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback, optional unsigned long? page, optional unsigned long? maxNumberPerPage) raises(WebAPIException); }; [NoInterfaceObject] interface MappedDataControlConsumer : DataControlConsumerObject { void addValue(unsigned long reqId, DOMString key, DOMString value, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void removeValue(unsigned long reqId, DOMString key, DOMString value, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void getValue(unsigned long reqId, DOMString key, DataControlGetValueSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); void updateValue(unsigned long reqId, DOMString key, DOMString oldValue, DOMString newValue, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback) raises(WebAPIException); }; [Callback=FunctionOnly, NoInterfaceObject] interface DataControlSuccessCallback { void onsuccess(unsigned long reqId); }; [Callback=FunctionOnly, NoInterfaceObject] interface DataControlErrorCallback { void onerror(unsigned long reqId, WebAPIError error); }; [Callback=FunctionOnly, NoInterfaceObject] interface DataControlInsertSuccessCallback { void onsuccess(unsigned long reqId, long insertRowId); }; [Callback=FunctionOnly, NoInterfaceObject] interface DataControlSelectSuccessCallback { void onsuccess(RowData[] rows, unsigned long reqId); }; [Callback=FunctionOnly, NoInterfaceObject] interface DataControlGetValueSuccessCallback { void onsuccess(DOMString[] values, unsigned long reqid); }; dictionary RowData { DOMString[] columns; DOMString[] values; }; };