top

DataControl API

This specification defines a DataControl API for applications.

The DataControl functionality provides a way to access specific data that is exported by other applications.

Please read the Data Control Guide to know how to share own application data with other applications.

Since: 2.4

Table of Contents

  1. 1. Type Definitions
    1. 1.1. DataType
  2. 2. Interfaces
    1. 2.1. DataControlManagerObject
    2. 2.2. DataControlManager
    3. 2.3. DataControlConsumerObject
    4. 2.4. SQLDataControlConsumer
    5. 2.5. MappedDataControlConsumer
    6. 2.6. DataControlSuccessCallback
    7. 2.7. DataControlErrorCallback
    8. 2.8. DataControlInsertSuccessCallback
    9. 2.9. DataControlSelectSuccessCallback
    10. 2.10. DataControlGetValueSuccessCallback
    11. 2.11. RowData
  3. 3. Full WebIDL

Summary of Interfaces and Methods

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, optional DOMString? order)
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

1. Type Definitions

1.1. DataType

Data types.
    enum DataType { "MAP", "SQL"};

Since: 2.4

2. Interfaces

2.1. DataControlManagerObject

Defines what is instantiated in the Tizen object.
    [NoInterfaceObject] interface DataControlManagerObject {
        readonly attribute DataControlManager datacontrol;
    };
    Tizen implements DataControlManagerObject;

Since: 2.4

The tizen.datacontrol object allows access to the DataControl API.

2.2. DataControlManager

This interface provides access to the DataControlManager object.
    [NoInterfaceObject] interface DataControlManager {
        DataControlConsumerObject getDataControlConsumer(DOMString providerId, DOMString dataId, DataType type) raises(WebAPIException);
    };

Since: 2.4

Methods

getDataControlConsumer
Gets DataControlConsumerObject with a given DataType.
DataControlConsumerObject getDataControlConsumer(DOMString providerId, DOMString dataId, DataType type);
             

Since: 2.4

Privilege level: public

Privilege: http://tizen.org/privilege/datacontrol.consumer

Parameters:

  • providerId: A provider ID to use, which should be shared between the DataControl provider and DataControl consumer.
  • dataId: A string for identifying specific data.
  • type: The DataType to use.

Return value:

DataControlConsumerObject The local DataControlConsumerObject.

Exceptions:

  • WebAPIException
    • 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);
 }
 

2.3. DataControlConsumerObject

This interface provides common attributes for other derived DataControlConsumerObject.
    [NoInterfaceObject] interface DataControlConsumerObject {
        readonly attribute DataType type;
        readonly attribute DOMString providerId;
        readonly attribute DOMString dataId;
    };

Since: 2.4

Attributes

  • readonly DataType type
    An attribute to store the DataType.

    Since: 2.4

  • readonly DOMString providerId
    An attribute to hold a provider identifier of the application with whom it shares the DataControl. This attribute should be known to users who want to interact with the application.

    Since: 2.4

  • readonly DOMString dataId
    The dataId identifies specific data, usually a database table to process(insert, delete, update). The string consists of one or more components, separated by a slash('/').

    Since: 2.4

2.4. SQLDataControlConsumer

This interface defines SQL data type operators.
    [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, optional DOMString? order) raises(WebAPIException);
    };

Since: 2.4

Methods

insert
Inserts new rows into a table owned by an SQL-type data control provider.
void insert(unsigned long reqId, RowData insertionData, optional DataControlInsertSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback);
             

Since: 2.4

Privilege level: public

Privilege: http://tizen.org/privilege/datacontrol.consumer

Parameters:

  • reqId: A unique identifier for the current operation.
    So a developer should increase the reqId value to ensure it is unique for each method.
  • insertionData: The data on columns and values to insert.
  • successCallback [optional] [nullable]: The method to invoke when the asynchronous call completes successfully.
  • errorCallback [optional] [nullable]: The method to invoke when an error occurs.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.

    • 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
Updates values of a table owned by an SQL-type data control provider.
void update(unsigned long reqId, RowData updateData, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback);
             

Since: 2.4

Privilege level: public

Privilege: http://tizen.org/privilege/datacontrol.consumer

Parameters:

  • reqId: A unique identifier for the current operation.
    So a developer should increase the reqId value to ensure it is unique for each method.
  • updateData: The data on columns and values to update.
  • where: A filter to select desired rows to update.
    It is an SQL WHERE clause excluding the WHERE itself such as column1 = 'stringValue' AND column2 = numericValue.
  • successCallback [optional] [nullable]: The method to invoke when the asynchronous call completes successfully.
  • errorCallback [optional] [nullable]: The method to invoke when an error occurs.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.

    • 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
Delete rows from a table that is owned by an SQL-type data control provider.
void remove(unsigned long reqId, DOMString where, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback);
             

Since: 2.4

Privilege level: public

Privilege: http://tizen.org/privilege/datacontrol.consumer

Parameters:

  • reqId: A unique identifier for the current operation.
    So a developer should increase the reqId value to ensure it is unique for each method.
  • where: A filter to select desired rows to remove.
    It is an SQL WHERE clause excluding the WHERE itself such as column1 = 'stringValue' AND column2 = numericValue.
  • successCallback [optional] [nullable]: The method to invoke when the asynchronous call completes successfully.
  • errorCallback [optional] [nullable]: The method to invoke when an error occurs.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.

    • 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
Selects the specified columns to be queried. The result set of the specified columns is retrieved from a table owned by an SQL-type data control provider.
void select(unsigned long reqId, DOMString[] columns, DOMString where, DataControlSelectSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback, optional unsigned long? page, optional unsigned long? maxNumberPerPage, optional DOMString? order);
             

Since: 2.4

If either of the page or maxNumberPerPage parameters are set to null or are not set, only the first 20 rows are included in the result set.

Privilege level: public

Privilege: http://tizen.org/privilege/datacontrol.consumer

Remark : order is supported since Tizen 3.0

Parameters:

  • reqId: A unique identifier for the current operation.
    So a developer should increase the reqId value to ensure it is unique for each method.
  • columns: The columns to select.
  • where: A filter to select desired rows.
    It is an SQL WHERE clause excluding the WHERE itself such as column1 = 'stringValue' AND column2 = numericValue.
  • successCallback: The method to invoke when the asynchronous call completes successfully.
  • errorCallback [optional] [nullable]: The method to invoke when an error occurs.
  • page [optional] [nullable]: The page number of the result set.
    It starts from 1. If the number is out of page, DataControlSelectSuccessCallback is invoked with no result data.
  • maxNumberPerPage [optional] [nullable]: The maximum number of rows on a page. The maximum allowed value is equal to 1024.
  • order [optional] [nullable]: The sorting order of the selected rows.
    It is an SQL ORDER BY clause excluding the ORDER BY itself such as column1, column2 ASC. If it is set to null, the order in which the rows are returned is undefined.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.

    • 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)
 {
     console.log("getValueSuccessCB result.length: " + result.length);
     var length = result.length;
     for (var i = 0; i < length; i++)
     {
         var rowData = "| ";
         var j = 0;
         for (j = 0; j < result[i].columns.length; j++)
         {
             rowData += "column: " + result[i].columns[j] + ", value: " + result[i].values[j] + " | ";
         }
         console.log(rowData);
     }
 }
 function errorcb(id, error)
 {
     console.log("error id : " + id + ", error msg : " + error.message);
 }

 try {
     // globalSQLConsumer and globalReqId should be defined before.
     // Increases globalReqId for uniqueness
     globalReqId++;
     var columns = ["WORD", "WORD_DESC" ];
     var whereClause = "1";
     console.log("----- Calling for ascending order -----");
     globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
             null, null, "WORD_DESC ASC");
     setTimeout( function() {
         console.log("----- Calling descending order -----");
         globalSQLConsumer.select(globalReqId, columns, whereClause, getValueSuccessCB, errorcb,
             null, null, "WORD_DESC DESC");
     }, 1000);
 }
 catch (err) {
     console.log (err.name +": " + err.message);
 }

 

2.5. MappedDataControlConsumer

This interface defines MAP data type operators.
    [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.4

Methods

addValue
Adds the value associated with the specified key to a key-values map owned by a MAP-type data control provider.
void addValue(unsigned long reqId, DOMString key, DOMString value, optional DataControlSuccessCallback? successCallback, optional DataControlErrorCallback? errorCallback);
             

Since: 2.4

Privilege level: public

Privilege: http://tizen.org/privilege/datacontrol.consumer

Parameters:

  • reqId: A unique identifier for the current operation.
    So a developer should increase the reqId value to ensure it is unique for each method.
  • key: The key to search mapped data.
  • value: The value to add into a values array mapped by the key.
  • successCallback [optional] [nullable]: The method to invoke when the asynchronous call completes successfully.
  • errorCallback [optional] [nullable]: The method to invoke when an error occurs.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.

    • 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
Removes the value associated with the specified key from a key-values map owned by a MAP-type data control provider.
void removeValue(unsigned long reqId, DOMString key, DOMString value, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback);
             

Since: 2.4

Privilege level: public

Privilege: http://tizen.org/privilege/datacontrol.consumer

Parameters:

  • reqId: A unique identifier for the current operation.
    So a developer should increase the reqId value to ensure it is unique for each method.
  • key: The key to search mapped data.
  • value: The value to remove from a values array mapped by the key.
  • successCallback: The method to invoke when the asynchronous call completes successfully.
  • errorCallback [optional] [nullable]: The method to invoke when an error occurs.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.

    • 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
Gets the value associated with the specified key, from a key-values map owned by a MAP-type data control provider.
void getValue(unsigned long reqId, DOMString key, DataControlGetValueSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback);
             

Since: 2.4

Privilege level: public

Privilege: http://tizen.org/privilege/datacontrol.consumer

Parameters:

  • reqId: A unique identifier for the current operation.
    So a developer should increase the reqId value to ensure it is unique for each method.
  • key: The key to search mapped data.
  • successCallback: The method to invoke when the asynchronous call completes successfully.
  • errorCallback [optional] [nullable]: The method to invoke when an error occurs.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.

    • 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
Sets the value associated with the specified key to a new value.
void updateValue(unsigned long reqId, DOMString key, DOMString oldValue, DOMString newValue, DataControlSuccessCallback successCallback, optional DataControlErrorCallback? errorCallback);
             

Since: 2.4

Privilege level: public

Privilege: http://tizen.org/privilege/datacontrol.consumer

Parameters:

  • reqId: A unique identifier for the current operation.
    So a developer should increase the reqId value to ensure it is unique for each method.
  • key: The key to search mapped data.
  • oldValue: The value to update in a values array mapped by the key.
  • newValue: The new value to replace in a values array mapped by the key.
  • successCallback: The method to invoke when the asynchronous call completes successfully.
  • errorCallback [optional] [nullable]: The method to invoke when an error occurs.

Exceptions:

  • WebAPIException
    • with error type TypeMismatchError, if the parameter type is not compatible with the expected type for that parameter.

    • 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);
 }
 

2.6. DataControlSuccessCallback

This interface provides a SuccessCallback for DataControlConsumerObject.
    [Callback=FunctionOnly, NoInterfaceObject] interface DataControlSuccessCallback {
        void onsuccess(unsigned long reqId);
    };

Since: 2.4

Methods

onsuccess
Called on success.
void onsuccess(unsigned long reqId);
             

Since: 2.4

Parameters:

  • reqId: A unique identifier of the successful operation.

2.7. DataControlErrorCallback

This interface provides an ErrorCallback for DataControlConsumerObject.
    [Callback=FunctionOnly, NoInterfaceObject] interface DataControlErrorCallback {
        void onerror(unsigned long reqId, WebAPIError error);
    };

Since: 2.4

Methods

onerror
Called on error.
void onerror(unsigned long reqId, WebAPIError error);
             

Since: 2.4

Parameters:

  • reqId: A unique identifier of the failed operation.
  • error: An error message.

2.8. DataControlInsertSuccessCallback

This interface provides a SuccessCallback for SQLDataControlConsumer.insert().
    [Callback=FunctionOnly, NoInterfaceObject] interface DataControlInsertSuccessCallback {
        void onsuccess(unsigned long reqId, long insertRowId);
    };

Since: 2.4

Methods

onsuccess
Called on success.
void onsuccess(unsigned long reqId, long insertRowId);
             

Since: 2.4

Parameters:

  • reqId: A unique identifier for the current operation.
    So it is recommended to increase the reqId value every time to guarantee uniqueness.
  • insertRowId: The inserted row ID set by the data control provider if the specified providerResult is true, else -1.

2.9. DataControlSelectSuccessCallback

This interface provides a SuccessCallback for SQLDataControlConsumer.select().
    [Callback=FunctionOnly, NoInterfaceObject] interface DataControlSelectSuccessCallback {
        void onsuccess(RowData[] rows, unsigned long reqId);
    };

Since: 2.4

Methods

onsuccess
Called on success.
void onsuccess(RowData[] rows, unsigned long reqId);
             

Since: 2.4

Parameters:

  • rows: Rows of SQL selection results from another application.
    The array operation of rows would be different from general JavaScript array behavior depending on platform implementation. For example, Array.isArray(rows) returns false.
  • reqId: A unique identifier for the current operation.
    So it is recommended to increase the reqId value every time to guarantee uniqueness.

2.10. DataControlGetValueSuccessCallback

This interface provides a SuccessCallback for MapDataControlConsumer.getValue().
    [Callback=FunctionOnly, NoInterfaceObject] interface DataControlGetValueSuccessCallback {
        void onsuccess(DOMString[] values, unsigned long reqid);
    };

Since: 2.4

Methods

onsuccess
Called on success.
void onsuccess(DOMString[] values, unsigned long reqid);
             

Since: 2.4

Parameters:

  • values: A list of values assigned to the requested key.
  • reqid: A unique identifier of the successful operation.

2.11. RowData

The dictionary represents RowData holding 1 row of SQL selection results from another application.
    dictionary RowData {
        DOMString[] columns;
        DOMString[] values;
    };

Since: 2.4

Dictionary members

DOMString[] columns
An attribute to hold column names to select, update, and insert.

Since: 2.4

DOMString[] values
An attribute to hold values of columns to select, update, and insert.

Since: 2.4

3. Full WebIDL

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, optional DOMString? order) 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;
    };
};