Provides a **DataShareHelper** instance to access or manage data on the server. Before invoking any method provided by **DataShareHelper**, you must create a **DataShareHelper** instance using [createDataShareHelper](#datasharecreatedatasharehelper).
Provides a **DataShareHelper** instance to access or manage data on the server. Before calling an API provided by **DataShareHelper**, you must create a **DataShareHelper** instance using [createDataShareHelper](#datasharecreatedatasharehelper).
This API can be used only in the stage model.
### openFile
...
...
@@ -109,6 +110,7 @@ This API can be used only in the stage model.
| Promise<number> | Promise used to return the index of the inserted data record.<br>The data index is not returned if the APIs of the database (for example, KVDB) in use do not support the return of indexes.|
| Promise<number> | Promise used to return the index of the inserted data record.<br>The data index is not returned if the APIs of the database in use (for example, KVDB) do not support the return of indexes.|
| uri | string | Yes | URI of the data to delete. |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.<br>The predicate methods supported by **delete()** vary depending on the database used. For example, the KVDB supports only **inKeys**.|
| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of deleted data records. Otherwise, **err** is an error object.<br>The number of deleted data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.|
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.<br>The predicate methods supported by **delete()** vary depending on the database in use. For example, the KVDB supports only **inKeys**.|
| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of deleted data records. Otherwise, **err** is an error object.<br>The number of deleted data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
| uri | string | Yes | URI of the data to delete. |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.<br>The predicate methods supported by **delete()** vary depending on the database used. For example, the KVDB supports only **inKeys**.|
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.<br>The predicate methods supported by **delete()** vary depending on the database in use. For example, the KVDB supports only **inKeys**.|
| Promise<number> | Promise used to return the number of deleted data records.<br>The number of deleted data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.|
| Promise<number> | Promise used to return the number of deleted data records.<br>The number of deleted data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
| uri | string | Yes | URI of the data to update. |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.<br>The predicate methods supported by **update()** vary depending on the database used. For example, only the relational database (RDB) supports predicates.|
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.<br>The predicate methods supported by **update()** vary depending on the database in use. For example, only the relational database (RDB) supports predicates.|
| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | New data. |
| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of updated data records. Otherwise, **err** is an error object.<br>The number of updated data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.|
| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of updated data records. Otherwise, **err** is an error object.<br>The number of updated data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
| uri | string | Yes | URI of the data to update. |
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.<br>The predicate methods supported by **update()** vary depending on the database used. For example, only the RDB supports predicates.|
| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.<br>The predicate methods supported by **update()** vary depending on the database in use. For example, only the relational database (RDB) supports predicates.|
| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | New data. |
| Promise<number> | Promise used to return the number of data records updated.<br>The number of updated data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.|
| Promise<number> | Promise used to return the number of data records updated.<br>The number of updated data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
| uri | string | Yes | URI of the data to insert. |
| values | Array<[ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket)> | Yes | Data to insert. |
| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of data records inserted. Otherwise, **err** is an error object.<br>The number of inserted data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.|
| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of data records inserted. Otherwise, **err** is an error object.<br>The number of inserted data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
| Promise<number> | Promise used to return the number of data records inserted.<br>The number of inserted data records is not returned if the APIs of the database (for example, KVDB) in use do not support it.|
| Promise<number> | Promise used to return the number of data records inserted.<br>The number of inserted data records is not returned if the APIs of the database (for example, KVDB) in use do not the return of the number of data records.|
| mimeTypeFilter | string | Yes | MIME types to match. Example:<br>**\*/\***: obtain all supported types.<br>**image/\***: obtain the MIMEs with the main type of **image**.<br>**\*/jpg**: obtains the MIMEs with subtype of **jpg**.|
| callback | openFile(uri: string, mode: string, callback: AsyncCallback<number>) { let err = {"code":0}; let fd = 0; callback(err,fd);}ts | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the MIME types obtained. Otherwise, **err** is an error object.|
| mimeTypeFilter | string | Yes | MIME types to match. Example:<br>**\*/\***: Obtain all supported types.<br>**image/\***: Obtain the MIMEs with the main type of **image**.<br>**\*/jpg**: Obtain the MIMEs with the subtype of **jpg**.|
| callback | AsyncCallback<Array\<string>> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the MIME types obtained. Otherwise, **err** is an error object.|
| mimeTypeFilter | string | Yes | MIME types to match. Example:<br>**\*/\***: obtain all supported types.<br>**image/\***: obtain the MIMEs with the main type of **image**.<br>**\*/jpg**: obtains the MIMEs with subtype of **jpg**.|
| mimeTypeFilter | string | Yes | MIME types to match. Example:<br>**\*/\***: Obtain all supported types.<br>**image/\***: Obtain the MIMEs with the main type of **image**.<br>**\*/jpg**: Obtain the MIMEs with the subtype of **jpg**.|
**Return value**
...
...
@@ -716,6 +734,7 @@ This API can be used only in the stage model.
Normalizes a DataShare URI. The normalized URI can be used across devices, and the DataShare URI can be used only by the local device. This API uses an asynchronous callback to return the result.
Normalizes a **DataShare** URI. The **DataShare** URI can be used only by the local device, but the normalized URI can be used across devices. This API uses an asynchronous callback to return the result.
This API can be used only in the stage model.
...
...
@@ -745,6 +764,7 @@ This API can be used only in the stage model.
Normalizes a DataShare URI. The normalized URI can be used across devices, and the DataShare URI can be used only by the local device. This API uses a promise to return the result.
Normalizes a **DataShare** URI. The **DataShare** URI can be used only by the local device, but the normalized URI can be used across devices. This API uses a promise to return the result.
This API can be used only in the stage model.
...
...
@@ -780,6 +800,7 @@ This API can be used only in the stage model.