diff --git a/CODEOWNERS b/CODEOWNERS index 0aff235ef178b06874f96feba8904316dcaa0454..ca2ba48baa68fb4990cc3e34fcf9ee5537ef1c28 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -198,6 +198,7 @@ zh-cn/application-dev/reference/apis/js-apis-router.md @HelloCrease zh-cn/application-dev/reference/apis/js-apis-display.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-screenshot.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-window.md @ge-yafang +zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-screen.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md @ge-yafang zh-cn/application-dev/reference/apis/js-apis-webgl.md @ge-yafang diff --git a/en/application-dev/device/device-location-geocoding.md b/en/application-dev/device/device-location-geocoding.md index cfb2504ff30266bdba5699b44f5f0577cc953ea9..30f647d98a368168ba945e11f11bb59f65a5b455 100644 --- a/en/application-dev/device/device-location-geocoding.md +++ b/en/application-dev/device/device-location-geocoding.md @@ -16,17 +16,18 @@ The following table describes APIs available for mutual conversion between coord | API | Description | | -------- | -------- | -| isGeoServiceAvailable(callback: AsyncCallback<boolean>) : void | Checks whether the (reverse) geocoding service is available. This function uses an asynchronous callback to return the result. | -| isGeoServiceAvailable() : Promise<boolean> | Checks whether the (reverse) geocoding service is available. This function uses a promise to return the result. | -| getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void | Converts coordinates into geographic description through reverse geocoding. This function uses an asynchronous callback to return the result. | -| getAddressesFromLocation(request: ReverseGeoCodeRequest) : Promise<Array<GeoAddress>>; | Converts coordinates into geographic description through reverse geocoding. This function uses a promise to return the result. | -| getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void | Converts geographic description into coordinates through geocoding. This function uses an asynchronous callback to return the result. | -| getAddressesFromLocationName(request: GeoCodeRequest) : Promise<Array<GeoAddress>> | Converts geographic description into coordinates through geocoding. This function uses a promise to return the result. | +| isGeoServiceAvailable(callback: AsyncCallback<boolean>) : void | Checks whether the (reverse) geocoding service is available. This function uses an asynchronous callback to return the result. | +| isGeoServiceAvailable() : Promise<boolean> | Checks whether the (reverse) geocoding service is available. This function uses a promise to return the result. | +| getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void | Converts coordinates into geographic description through reverse geocoding. This function uses an asynchronous callback to return the result. | +| getAddressesFromLocation(request: ReverseGeoCodeRequest) : Promise<Array<GeoAddress>>; | Converts coordinates into geographic description through reverse geocoding. This function uses a promise to return the result. | +| getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>) : void | Converts geographic description into coordinates through geocoding. This function uses an asynchronous callback to return the result. | +| getAddressesFromLocationName(request: GeoCodeRequest) : Promise<Array<GeoAddress>> | Converts geographic description into coordinates through geocoding. This function uses a promise to return the result. | ## How to Develop -> ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** +> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> > The **GeoConvert** instance needs to access backend services to obtain information. Therefore, before performing the following steps, ensure that your device is connected to the network. 1. Import the **geolocation** module by which you can implement all APIs related to the geocoding and reverse geocoding conversion capabilities. @@ -45,7 +46,7 @@ The following table describes APIs available for mutual conversion between coord }); ``` - Your application can obtain the **GeoAddress** list that matches the specified coordinates and then read location information from it. For details, see the _API Reference_. + Your application can obtain the **GeoAddress** list that matches the specified coordinates and then read location information from it. For details, see [Geolocation](../reference/apis/js-apis-geolocation.md). - Call **getAddressesFromLocationName** to convert geographic description into coordinates. ``` @@ -55,6 +56,6 @@ The following table describes APIs available for mutual conversion between coord }); ``` - Your application can obtain the **GeoAddress** list that matches the specified location information and read coordinates from it. For details, see the _API Reference_. + Your application can obtain the **GeoAddress** list that matches the specified location information and read coordinates from it. For details, see [Geolocation](../reference/apis/js-apis-geolocation.md). To improve the accuracy of location results, you can set the longitude and latitude ranges in **GeoCodeRequest**. diff --git a/en/application-dev/dfx/Readme-EN.md b/en/application-dev/dfx/Readme-EN.md index 06b61fb2e8e733f0762e0f1f5ddae9ea81344396..b8c6422a63e1f3fb8bd012a3e4175de1da055d8f 100644 --- a/en/application-dev/dfx/Readme-EN.md +++ b/en/application-dev/dfx/Readme-EN.md @@ -9,3 +9,5 @@ - Distributed Call Chain Tracing - [Overview of Distributed Call Chain Tracing](hitracechain-overview.md) - [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md) +- Error Management + - [Development of Error Manager](errormanager-guidelines.md) diff --git a/en/application-dev/dfx/errormanager-guidelines.md b/en/application-dev/dfx/errormanager-guidelines.md new file mode 100644 index 0000000000000000000000000000000000000000..835a6ab9ce3c0beacd19f7c76f5a1eec68bf36cd --- /dev/null +++ b/en/application-dev/dfx/errormanager-guidelines.md @@ -0,0 +1,90 @@ +# Development of Error Manager + +## When to Use + +If coding specification issues or errors exist in the code of an application, the application may encounter unexpected errors, for example, uncaught exceptions or application lifecycle timeouts, while it is running. In such a case, the application may exit unexpectedly. Error logs, however, are usually stored on users' local storage, making it inconvenient to locate faults. With the APIs provided by the **errorManager** module, your application will be able to report related errors and logs to your service platform for fault locating before it exits. + +## Available APIs + +Application error management APIs are provided by the **errorManager** module. For details about how to import the module to use related APIs, see [Development Example](#development-example). + +**Table 1** Description of application error management APIs + +| API | Description | +| ------------------------------------------------------------ | ---------------------------------------------------- | +| registerErrorObserver(observer: ErrorObserver): number | Registers an observer for application errors. A callback will be invoked when an application error is detected. This API works in a synchronous manner. The return value is the SN of the registered observer.| +| unregisterErrorObserver(observerId: number, callback: AsyncCallback\): void | Unregisters an observer in callback mode. The number passed to this API is the SN of the registered observer. | +| unregisterErrorObserver(observerId: number): Promise\ | Unregisters an observer in promise mode. The number passed to this API is the SN of the registered observer. | + +When an asynchronous callback is used, the return value can be processed directly in the callback. If a promise is used, the return value can also be processed in the promise in a similar way. For details about the result codes, see [Result Codes for Unregistering an Observer](#result-codes-for-unregistering-an-observer). + + +**Table 2** Description of the ErrorObserver API + +| API | Description | +| ------------------------------ | ------------------------------------------------------------ | +| onUnhandledException(errMsg: string): void | Called when an application generates an uncaught exception after being registered.| + + +### Result Codes for Unregistering an Observer + +| Result Code| Description | +| ------ | --------------------------- | +| 0 | Normal. | +| -1 | Input number not exist. | +| -2 | Invalid parameter. | + +## Development Example +```ts +import Ability from '@ohos.application.Ability' +import errorManager from '@ohos.application.errorManager' + +var registerId = -1; +var callback = { + onUnhandledException: function (errMsg) { + console.log(errMsg); + } +} +export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate") + globalThis.abilityWant = want; + } + + onDestroy() { + console.log("[Demo] MainAbility onDestroy") + } + + onWindowStageCreate(windowStage) { + // Main window is created for this ability. + console.log("[Demo] MainAbility onWindowStageCreate") + + globalThis.registerObserver = (() => { + registerId = errorManager.registerErrorObserver(callback); + }) + + globalThis.unRegisterObserver = (() => { + errorManager.unregisterErrorObserver(registerId, (result) => { + console.log("[Demo] result " + result.code + ";" + result.message) + }); + }) + + windowStage.setUIContent(this.context, "pages/index", null) + } + + onWindowStageDestroy() { + // Main window is destroyed to release UI resources. + console.log("[Demo] MainAbility onWindowStageDestroy") + } + + onForeground() { + // Ability is brought to the foreground. + console.log("[Demo] MainAbility onForeground") + } + + onBackground() { + // Ability is brought back to the background. + console.log("[Demo] MainAbility onBackground") + } +}; +``` diff --git a/en/application-dev/reference/apis/js-apis-bytrace.md b/en/application-dev/reference/apis/js-apis-bytrace.md index 40a50ebc4aa5ea496d19df951ff04d03240a1b93..3d532293b18ca1b262feabe80615dc1807ac30dc 100644 --- a/en/application-dev/reference/apis/js-apis-bytrace.md +++ b/en/application-dev/reference/apis/js-apis-bytrace.md @@ -1,6 +1,6 @@ # Performance Tracing -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** > - The APIs of this module are no longer maintained since API version 8. It is recommended that you use the APIs of [hiTraceMeter](js-apis-hitracemeter.md) instead. > - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -17,7 +17,7 @@ import bytrace from '@ohos.bytrace'; startTrace(name: string, taskId: number, expectedTime?: number): void -Starts a trace task. **expectedTime** is an optional parameter, which specifies the expected duration of the trace. +Marks the start of a timeslice trace task. **System capability**: SystemCapability.Developtools.Bytrace @@ -25,11 +25,12 @@ Starts a trace task. **expectedTime** is an optional parameter, which specifies | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| name | string | Yes| Name of the trace task to start.| -| taskId | number | Yes| Task ID.| +| name | string | Yes| Name of a timeslice trace task.| +| taskId | number | Yes| ID of a timeslice trace task.| | expectedTime | number | No| Expected duration of the trace, in ms.| -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same taskId can be used. For details, see the bytrace.finishTrace example. **Example** @@ -44,7 +45,7 @@ bytrace.startTrace("myTestFunc", 1, 5); // The expected duration of the trace is finishTrace(name: string, taskId: number): void -Stops a trace task. +Marks the end of a timeslice trace task. **System capability**: SystemCapability.Developtools.Bytrace @@ -52,10 +53,11 @@ Stops a trace task. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| name | string | Yes| Name of the trace task to start.| -| taskId | number | Yes| Task ID.| +| name | string | Yes| Name of a timeslice trace task.| +| taskId | number | Yes| ID of a timeslice trace task.| -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** +> **NOTE** +> > To stop a trace task, the values of name and task ID in **finishTrace** must be the same as those in **startTrace**. **Example** @@ -91,7 +93,7 @@ bytrace.finishTrace("myTestFunc", 1); traceByValue(name: string, count: number): void -Traces the value changes of a variable. +Defines the variable that indicates the number of timeslice trace tasks. **System capability**: SystemCapability.Developtools.Bytrace diff --git a/zh-cn/application-dev/database/Readme-CN.md b/zh-cn/application-dev/database/Readme-CN.md index f52d1f24dd42ae50568007e904d13f788574995e..9dedd234837cd5f5fa13d4f34525c4849fcb67fe 100644 --- a/zh-cn/application-dev/database/Readme-CN.md +++ b/zh-cn/application-dev/database/Readme-CN.md @@ -12,3 +12,6 @@ - 分布式数据对象 - [分布式数据对象概述](database-distributedobject-overview.md) - [分布式数据对象开发指导](database-distributedobject-guidelines.md) +- 数据共享 + - [数据共享概述](database-datashare-overview.md) + - [数据共享开发指导](database-datashare-guidelines.md) diff --git a/zh-cn/application-dev/database/database-datashare-guidelines.md b/zh-cn/application-dev/database/database-datashare-guidelines.md index 79a62d26f23f7d3dfa71f5ea97a9561bd3646c06..8bdbd59a824ec23f7a59f7bd810e0cf218e2f7b0 100644 --- a/zh-cn/application-dev/database/database-datashare-guidelines.md +++ b/zh-cn/application-dev/database/database-datashare-guidelines.md @@ -1,4 +1,4 @@ -# DataShare开发指导 +# 数据共享开发指导 DataShare即数据共享模块,提供了向其他应用共享以及管理其数据的方法。目前仅支持同个设备上应用之间的数据共享。 ## 接口说明 diff --git a/zh-cn/application-dev/database/database-datashare-overview.md b/zh-cn/application-dev/database/database-datashare-overview.md index 1adbf97d0a9742351baff9c515cb6eb6302076cf..4131d8bb13c5bb3ee5e6a07bc6ed5828b8459411 100644 --- a/zh-cn/application-dev/database/database-datashare-overview.md +++ b/zh-cn/application-dev/database/database-datashare-overview.md @@ -1,4 +1,4 @@ -# 数据共享开发概述 +# 数据共享概述 ## 数据共享简介 diff --git a/zh-cn/application-dev/database/database-relational-guidelines.md b/zh-cn/application-dev/database/database-relational-guidelines.md index add3bf98baa31c184f521122342586e752a8b84b..8a46eeaf4e5bb678fa39eecd48c52c0dea5c7b4c 100644 --- a/zh-cn/application-dev/database/database-relational-guidelines.md +++ b/zh-cn/application-dev/database/database-relational-guidelines.md @@ -131,8 +131,8 @@ | ResultSet | goToPreviousRow(): boolean | 将结果集向前移动一行。 | | ResultSet | getColumnIndex(columnName: string): number | 根据指定的列名获取列索引。 | | ResultSet | getColumnName(columnIndex: number): string | 根据指定的列索引获取列名。 | -| ResultSet | goToFirstRow(): boolean | 判断结果集当前位置是否在第一行。 | -| ResultSet | goToLastRow(): boolean | 判断结果集当前位置是否在最后一行。 | +| ResultSet | goToFirstRow(): boolean | 将结果集移动到第一行。 | +| ResultSet | goToLastRow(): boolean | 将结果集移动到最后一行。 | | ResultSet | getString(columnIndex: number): string | 获取当前行指定列的值,以String类型返回。 | | ResultSet | getBlob(columnIndex: number): Uint8Array | 获取当前行指定列的值,以字节数组形式返回。 | | ResultSet | getDouble(columnIndex: number): number | 获取当前行指定列的值,以double型返回。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md index c0457666f5fce5869fe5bcbff71511fc6a9fedcb..45f2c957bafe33532b81c6b87f3a7c92d6a628d2 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -1687,7 +1687,7 @@ bundle.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataNa setDisposedStatus(bundleName: string, status: number, callback: AsyncCallback\): void; -以异步方法根据给定的bundleName和status来设置对应应用的处置状态,使用callback形式返回结果。 +此接口为系统接口,以异步方法根据给定的bundleName和status来设置对应应用的处置状态,使用callback形式返回结果。 **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS @@ -1717,7 +1717,7 @@ bundle.setDisposedStatus(bundleName, status, caller) setDisposedStatus(bundleName: string, status: number): Promise\; -以异步方法根据给定的bundleName和status来设置对应应用的处置状态,使用Promise形式返回结果。 +此接口为系统接口,以异步方法根据给定的bundleName和status来设置对应应用的处置状态,使用Promise形式返回结果。 **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS @@ -1751,9 +1751,10 @@ bundle.setDisposedStatus(bundleName, status).then(data=>{ ## bundle.getDisposedStatus9+ -getDisposedStatus(bundleName: string,, callback: AsyncCallback\): void; +getDisposedStatus(bundleName: string, callback: AsyncCallback\): void; + +此接口为系统接口,以异步方法根据给定的bundleName来获取对应应用的处置状态,使用callback形式返回结果。 -以异步方法根据给定的bundleName来获取对应应用的处置状态,使用callback形式返回结果。 **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS **系统能力:** SystemCapability.BundleManager.BundleFramework @@ -1778,9 +1779,9 @@ bundle.getDisposedStatus(bundleName, caller) ## bundle.getDisposedStatus9+ -getDisposedStatus(bundleName: string, status: number): Promise\; +getDisposedStatus(bundleName: string): Promise\; -以异步方法根据给定的bundleName来获取对应应用的处置状态,使用Promise形式返回结果。 +此接口为系统接口,以异步方法根据给定的bundleName来获取对应应用的处置状态,使用Promise形式返回结果。 **需要权限:** ohos.permission.MANAGE_DISPOSED_APP_STATUS diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md index cfbcbb9b3ac4773907da74a3c2e5e038b232314b..f5105c22fdff8d1f43160f864127996ad58c0de8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md @@ -17,6 +17,14 @@ import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility' ``` +## 属性 + +**系统能力**:SystemCapability.DistributedDataManager.DataShare.Provider + +| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| context | [ExtensionContext](js-apis-extension-context.md) | 是 | 否 |表示数据共享扩展能力上下文。 | + ## onCreate onCreate?(want: Want, callback: AsyncCallback<void>): void @@ -284,9 +292,9 @@ export default class DataShareExtAbility extends DataShareExtensionAbility { }; ``` -## BatchInsert +## batchInsert -BatchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: AsyncCallback<number>): void +batchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: AsyncCallback<number>): void 在数据库批量插入时服务端回调此接口,该方法可以选择性重写。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md index e8fa4ee743ba15459324de3ece7a6829d96d7192..fa422cfa48a23fb8c081fc713fef454c4c607e87 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md @@ -17,7 +17,7 @@ import WindowExtensionAbility from '@ohos.application.WindowExtensionAbility'; ## 属性 -**系统能力:** SystemCapability.Ability.AbilityRuntime.Core +**系统能力:** SystemCapability.WindowManager.WindowManager.Core | 名称 | 参数类型 | 可读 | 可写 | 说明 | | --------- | -------- | ---- | ---- | ------------------------- | @@ -29,7 +29,7 @@ onConnect(want: Want): rpc.RemoteObject 当窗口扩展组件第一次连接ability时回调。 -**系统能力:** SystemCapability.Ability.AbilityRuntime.Core +**系统能力:** SystemCapability.WindowManager.WindowManager.Core | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | @@ -86,7 +86,7 @@ onDisconnect(want: Want): void 当所有连接到窗口扩展组件的ability断开连接时回调。 -**系统能力:** SystemCapability.Ability.AbilityRuntime.Core +**系统能力:** SystemCapability.WindowManager.WindowManager.Core | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | @@ -112,7 +112,7 @@ onWindowReady(window: Window): void 当窗口被创建时回调。 -**系统能力:** SystemCapability.Ability.AbilityRuntime.Core +**系统能力:** SystemCapability.WindowManager.WindowManager.Core | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md b/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md index 594c29417b3cd9c48d1983b85312eab6a702bd28..d66146a2651c473b10eb82089cddd59c0122a32f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-rdb.md @@ -781,13 +781,6 @@ distinct(): RdbPredicates ```js let predicates = new data_rdb.RdbPredicates("EMPLOYEE") predicates.equalTo("NAME", "Rose").distinct("NAME") -let promise = rdbStore.query(predicates, ["NAME"]) -promise.then((resultSet) => { - console.log("ResultSet column names: " + resultSet.columnNames) - console.log("ResultSet column count: " + resultSet.columnCount) -}).catch((err) => { - console.log("Query err.") -}) ``` @@ -1133,7 +1126,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) { ``` ### update9+ -update(table: string, values: ValuesBucket, predicates: DataSharePredicates):Promise<number> +update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise<number> 根据DataSharePredicates的指定实例对象更新数据库中的数据,结果以Promise形式返回。 @@ -1231,7 +1224,7 @@ promise.then((rows) => { ### delete9+ -delete(table: string, predicates: DataSharePredicates, callback: AsyncCallback<number>):void +delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void 根据DataSharePredicates的指定实例对象从数据库中删除数据,结果以callback形式返回。 @@ -1354,7 +1347,7 @@ query(predicates: RdbPredicates, columns?: Array<string>):Promise<Resul ### query9+ -query(predicates: DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void +query(predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void 根据指定条件查询数据库中的数据,结果以callback形式返回。 @@ -1384,7 +1377,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], ### query9+ -query(predicates: DataSharePredicates, columns?: Array<string>):Promise<ResultSet> +query(predicates: dataSharePredicates.DataSharePredicates, columns?: Array<string>):Promise<ResultSet> 根据指定条件查询数据库中的数据,结果以Promise形式返回。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md index 62217a7b2c65e6c0b5d1e08b92d0210903b41c19..f043079681dfc50caa3c56b86b6c7ee615bfda6a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributed-data.md @@ -814,7 +814,7 @@ try { console.log('getResultSet succeed.'); resultSet = result; }).catch((err) => { - console.log('getResultSet failed:ed: ' + err); + console.log('getResultSet failed: ' + err); }); const count = resultSet.getCount(); console.log("getCount succeed:" + count); @@ -847,7 +847,7 @@ try { console.log('getResultSet succeeed.'); resultSet = result; }).catch((err) => { - console.log('getResultSet failed:ed: ' + err); + console.log('getResultSet failed: ' + err); }); const position = resultSet.getPosition(); console.log("getPosition succeed:" + position); diff --git a/zh-cn/application-dev/reference/apis/js-apis-media.md b/zh-cn/application-dev/reference/apis/js-apis-media.md index 50438f8ed64fa045d2b4710ea1dcb5ff2df9e31d..d3bcdb125e4fb4321580a5ed9a2644ae1ec87a06 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-media.md +++ b/zh-cn/application-dev/reference/apis/js-apis-media.md @@ -273,7 +273,7 @@ Codec MIME类型枚举。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ----------- | ------------------------- | ---- | ---- | ------------------------------------------------------------ | -| src | string | 是 | 是 | 音频媒体URI,支持当前主流的音频格式(mp4、aac、mp3、ogg、wav)。
**支持路径示例**:
1、fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2、http网络播放: http://xx
3、https网络播放: https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | +| src | string | 是 | 是 | 音频媒体URI,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2. http网络播放: http://xx
3. https网络播放: https://xx
4. hls网络播放路径:http://xx或者https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | | loop | boolean | 是 | 是 | 音频循环播放属性,设置为'true'表示循环播放。 | | currentTime | number | 是 | 否 | 音频的当前播放位置。 | | duration | number | 是 | 否 | 音频时长。 | @@ -665,7 +665,7 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------------------ | ---------------------------------- | ---- | ---- | ------------------------------------------------------------ | -| url8+ | string | 是 | 是 | 视频媒体URL,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2、http网络播放: http://xx
3、https网络播放: https://xx
3、hls网络播放路径:http://xx或者https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | +| url8+ | string | 是 | 是 | 视频媒体URL,支持当前主流的视频格式(mp4、mpeg-ts、webm、mkv)。
**支持路径示例**:
1. fd类型播放:fd://xx
![](figures/zh-cn_image_url.png)
2. http网络播放: http://xx
3. https网络播放: https://xx
4. hls网络播放路径:http://xx或者https://xx
**注意事项**:
使用媒体素材需要获取读权限,否则无法正常播放。 | | loop8+ | boolean | 是 | 是 | 视频循环播放属性,设置为'true'表示循环播放。 | | currentTime8+ | number | 是 | 否 | 视频的当前播放位置。 | | duration8+ | number | 是 | 否 | 视频时长,返回-1表示直播模式。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-process.md b/zh-cn/application-dev/reference/apis/js-apis-process.md index b3de31b42ffc7139e93b540020b620b7d51a1614..248789076260954647828c891e77e8aa5bba5b28 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-process.md +++ b/zh-cn/application-dev/reference/apis/js-apis-process.md @@ -92,7 +92,7 @@ getOutput(): Promise<Uint8Array> ```js var child = process.runCmd('ls'); var result = child.wait(); -child.getOutput.then(val=>{ +child.getOutput().then(val=>{ console.log("child.getOutput = " + val); }) ``` @@ -119,7 +119,7 @@ getErrorOutput(): Promise<Uint8Array> ```js var child = process.runCmd('madir test.text'); var result = child.wait(); -child.getErrorOutput.then(val=>{ +child.getErrorOutput().then(val=>{ console.log("child.getErrorOutput= " + val); }) ``` @@ -286,7 +286,7 @@ getThreadPriority(v: number): number **示例:** ```js -var tid = process.getTid(); +var tid = process.tid; var pres = process.getThreadPriority(tid); ``` @@ -617,5 +617,5 @@ kill(signal: number, pid: number): boolean ```js var pres = process.pid -var result = that.kill(28, pres) +var result = process.kill(28, pres) ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md index 065c993b491e5d045e14fa1cd022c27dbc4bd2df..7581861012f98b643114b083430ce37cf1ae0734 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @@ -302,7 +302,7 @@ sendScreenLockEvent(event: String, parameter: number): Promise **示例**: ```js - screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((err, result) => { + screenlock.sendScreenLockEvent('unlockScreenResult', 0).then((result) => { console.log('sending result:' + result); }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-uri.md b/zh-cn/application-dev/reference/apis/js-apis-uri.md index ac6946ca66f150ecfe0b2d08198ba0f050e4e332..b5a432841036c20a98e6cc6f160320847a7165fc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uri.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uri.md @@ -71,8 +71,8 @@ toString(): string **示例:** ```js -const uri = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); -uri.toString() +const result = new uri.URI('http://username:password@host:8080/directory/file?query=pppppp#qwer=da'); +result.toString() ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-url.md b/zh-cn/application-dev/reference/apis/js-apis-url.md index d85642ef859b8cae2765234923257bd7b640268c..eab93b045720c98fe9c3da9cde16a1f921f745a5 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-url.md +++ b/zh-cn/application-dev/reference/apis/js-apis-url.md @@ -31,7 +31,7 @@ URLSearchParams的构造函数。 ```js var objectParams = new Url.URLSearchParams([ ['user1', 'abc1'], ['query2', 'first2'], ['query3', 'second3'] ]); -var objectParams1 = new Url.URLSearchParams({"fod" : 1 , "bard" : 2}); +var objectParams1 = new Url.URLSearchParams({"fod" : '1' , "bard" : '2'}); var objectParams2 = new Url.URLSearchParams('?fod=1&bard=2'); var urlObject = new Url.URL('https://developer.mozilla.org/?fod=1&bard=2'); var params = new Url.URLSearchParams(urlObject.search); @@ -58,7 +58,7 @@ append(name: string, value: string): void ```js let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.append('fod', 3); +paramsObject.append('fod', '3'); ``` @@ -110,7 +110,7 @@ getAll(name: string): string[] ```js let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.append('fod', 3); // Add a second value for the fod parameter. +paramsObject.append('fod', '3'); // Add a second value for the fod parameter. console.log(params.getAll('fod')) // Output ["1","3"]. ``` @@ -196,10 +196,9 @@ get(name: string): string | null **示例:** ```js -var paramsOject = new Url.URLSearchParams(document.location.search.substring(1)); +var paramsOject = new Url.URLSearchParams('name=Jonathan&age=18'); var name = paramsOject.get("name"); // is the string "Jonathan" var age = parseInt(paramsOject.get("age"), 10); // is the number 18 -var address = paramsOject.get("address"); // null ``` @@ -252,7 +251,7 @@ set(name: string, value: string): void ```js let urlObject = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLSearchParams(urlObject.search.slice(1)); -paramsObject.set('baz', 3); // Add a third parameter. +paramsObject.set('baz', '3'); // Add a third parameter. ``` @@ -364,7 +363,7 @@ toString(): string ```js let url = new Url.URL('https://developer.exampleUrl/?fod=1&bard=2'); let params = new Url.URLSearchParams(url.search.slice(1)); -params.append('fod', 3); +params.append('fod', '3'); console.log(params.toString()); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-util.md b/zh-cn/application-dev/reference/apis/js-apis-util.md index 193b6fb237deaafa28a0c5620b435f9d428d5c84..3d100dcbe2556cd7b2aa0676d05877d1a9f0320e 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-util.md +++ b/zh-cn/application-dev/reference/apis/js-apis-util.md @@ -90,11 +90,12 @@ callbackWrapper(original: Function): (err: Object, value: Object )=>void async function promiseFn() { return Promise.reject('value'); } + var err = "type err"; var cb = util.callbackWrapper(promiseFn); cb((err, ret) => { console.log(err); console.log(ret); - }) + }, err) ``` @@ -121,16 +122,12 @@ promiseWrapper(original: (err: Object, value: Object) => void): Object **示例:** ```js - function aysnFun(str1, str2, callback) { - if (typeof str1 === 'string' && typeof str2 === 'string') { - callback(null, str1 + str2); - } else { - callback('type err'); - } + function aysnFun() { + return 0; } - let newPromiseObj = util.promiseWrapper(aysnFun)("Hello", 'World'); - newPromiseObj.then(res => { - console.log(res); + let newPromiseObj = util.promiseWrapper(aysnFun); + newPromiseObj().then(res => { + console.log(res); }) ``` @@ -321,10 +318,11 @@ encodeInto(input: string, dest: Uint8Array, ): { read: number; written: number } **示例:** ```js - var that = new util.TextEncoder(); - var buffer = new ArrayBuffer(4); - this.dest = new Uint8Array(buffer); - var result = that.encodeInto("abcd", this.dest); + var that = new util.TextEncoder() + var buffer = new ArrayBuffer(4) + var dest = new Uint8Array(buffer) + var result = new Object() + result = that.encodeInto('abcd', dest) ``` ## RationalNumber8+ @@ -371,7 +369,7 @@ static createRationalFromString​(rationalString: string): RationalNumber​ **示例:** ```js var rationalNumber = new util.RationalNumber(1,2); - var rational = rationalNumer.creatRationalFromString("3/4"); + var rational = util.RationalNumber.createRationalFromString("3/4"); ``` @@ -396,7 +394,7 @@ compareTo​(another: RationalNumber): number​ **示例:** ```js var rationalNumber = new util.RationalNumber(1,2); - var rational = rationalNumer.creatRationalFromString("3/4"); + var rational = util.RationalNumber.createRationalFromString("3/4"); var result = rationalNumber.compareTo(rational); ``` @@ -442,7 +440,7 @@ equals​(obj: Object): boolean **示例:** ```js var rationalNumber = new util.RationalNumber(1,2); - var rational = rationalNumer.creatRationalFromString("3/4"); + var rational = util.RationalNumber.createRationalFromString("3/4"); var result = rationalNumber.equals(rational); ``` @@ -469,7 +467,7 @@ static getCommonDivisor​(number1: number,number2: number): number **示例:** ```js var rationalNumber = new util.RationalNumber(1,2); - var result = rationalNumber.getCommonDivisor(4,6); + var result = util.RationalNumber.getCommonDivisor(4,6); ``` @@ -706,7 +704,7 @@ clear(): void ```js var pro = new util.LruBuffer(); pro.put(2,10); - var result = pro.size(); + var result = pro.length; pro.clear(); ``` @@ -988,14 +986,6 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void { super(); } - static getInstance() - { - if(this.instance == null) - { - this.instance = new ChildLruBuffer(); - } - return this.instance; - } afterRemoval(isEvict, key, value, newValue) { if (isEvict === false) @@ -1004,7 +994,8 @@ afterRemoval(isEvict: boolean,key: K,value: V,newValue: V): void } } } - ChildLruBuffer.getInstance().afterRemoval(false,10,30,null); + var lru = new ChildLruBuffer(); + lru.afterRemoval(false,10,30,null); ``` @@ -1097,7 +1088,7 @@ entries(): IterableIterator<[K,V]> ```js var pro = new util.LruBuffer(); pro.put(2,10); - var result = pro[symbol.iterator](); + var result = pro[Symbol.iterator](); ``` @@ -1585,7 +1576,7 @@ encode(src: Uint8Array): Promise<Uint8Array> var rarray = new Uint8Array([99,122,69,122]); that.encode(array).then(val=>{ for (var i = 0; i < rarray.length; i++) { - console.log(val[i]) + console.log(val[i].toString()) } }) ``` @@ -1644,7 +1635,7 @@ decode(src: Uint8Array | string): Promise<Uint8Array> var rarray = new Uint8Array([115,49,51]); that.decode(array).then(val=>{ for (var i = 0; i < rarray.length; i++) { - console.log(val[i]) + console.log(val[i].toString()) } }) ``` @@ -1688,7 +1679,7 @@ isAnyArrayBuffer(value: Object): boolean **示例:** ```js var that = new util.types(); - var result = that.isAnyArrayBuffer(new ArrayBuffer([])); + var result = that.isAnyArrayBuffer(new ArrayBuffer(0)); ``` @@ -1768,7 +1759,7 @@ isArrayBuffer(value: Object): boolean **示例:** ```js var that = new util.types(); - var result = that.isArrayBuffer(new ArrayBuffer([])); + var result = that.isArrayBuffer(new ArrayBuffer(0)); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md index 6cd749107fbf9f9a43eb28156bc57f58e7f0b6fb..4a8a90137257be89ec32a2651130e15a6d94df77 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @@ -638,7 +638,7 @@ getPixelMap(wallpaperType: WallpaperType): Promise<image.PixelMap> **示例:** ```js - wallpaper.getPixelMap(WALLPAPER_SYSTEM).then((data) => { + wallpaper.getPixelMap(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => { console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem data : ' + data); console.info('wallpaperXTS ===> testGetPixelMapPromiseSystem data : ' + JSON.stringify(data)); }).catch((err) => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-xml.md b/zh-cn/application-dev/reference/apis/js-apis-xml.md index d004358e5f12565e4b5e6900a11e1b3d2e0baad0..412412d1c59b21053c292b55c692ae4ad5579c71 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-xml.md +++ b/zh-cn/application-dev/reference/apis/js-apis-xml.md @@ -146,7 +146,7 @@ thatSer.setNamespace("h", "http://www.w3.org/TR/html4/"); thatSer.startElement("table"); thatSer.setAttributes("importance", "high"); thatSer.setText("Happy"); -endElement(); // => Happy +thatSer.endElement(); // => Happy ``` diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md index b01cd2d170cb2ff462f74bb1ad4e91e560f0ae85..2e458bc5ee479c197ca853d7fa15576ff7b43fa9 100644 --- a/zh-cn/application-dev/website.md +++ b/zh-cn/application-dev/website.md @@ -253,6 +253,9 @@ - 分布式数据对象 - [分布式数据对象概述](database/database-distributedobject-overview.md) - [分布式数据对象开发指导](database/database-distributedobject-guidelines.md) + - 数据共享 + - [数据共享概述](database/database-datashare-overview.md) + - [数据共享开发指导](database/database-datashare-guidelines.md) - 任务管理 - 后台任务 - [后台任务概述](task-management/background-task-overview.md) diff --git a/zh-cn/device-dev/kernel/kernel-mini-extend-dynamic-loading.md b/zh-cn/device-dev/kernel/kernel-mini-extend-dynamic-loading.md index feff1561c57d548749c17239b703240441b24033..22a9c5443e3a6bff91be15c204c33d583e757aba 100644 --- a/zh-cn/device-dev/kernel/kernel-mini-extend-dynamic-loading.md +++ b/zh-cn/device-dev/kernel/kernel-mini-extend-dynamic-loading.md @@ -96,3 +96,11 @@ Program Headers: 4. “-z max-page-size=4”链接选项:二进制文件中可加载段的对齐字节数为4,可节约内存,可用于动态库。 5. “-mcpu=”需要指定对应的cpu架构。 + + +## 约束 + + +- 不支持应用程序加载,只支持共享库加载。 +- 待加载的共享库不能依赖编译器中的libc库及其他共享库,只能依赖内核提供的对外接口(由导出的符号表提供)。 +- 依赖交叉编译器及文件系统。 \ No newline at end of file diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md index ef824fc8fb8e6f7c8d7bf8cd619d1a7a34d107da..8bdbbb113e4ab52556ce292865b84c90e1620402 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3516-helloworld.md @@ -55,7 +55,7 @@ applications/sample/hello ``` 3. 添加新组件。 - 修改文件**build/lite/components/applications.json**,添加组件hello_world_app的配置,如下所示为applications.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): + 修改文件**build/lite/components/communication.json**,添加组件hello_world_app的配置,如下所示为communication.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): ``` diff --git a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md index 023fca41a0925099ea0a94f119e45545f17cfd27..5d2aec5f49af0895e1b5d985a3331beb4481dc0e 100644 --- a/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md +++ b/zh-cn/device-dev/quick-start/quickstart-ide-lite-steps-hi3861-helloworld.md @@ -58,7 +58,7 @@ - include_dirs中指定source所需要依赖的.h文件路径。 4. 添加新组件。 - 修改文件**build/lite/components/applications.json**,添加组件hello_world_app的配置,如下所示为applications.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): + 修改文件**build/lite/components/communication.json**,添加组件hello_world_app的配置,如下所示为communication.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): ``` diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md index ef824fc8fb8e6f7c8d7bf8cd619d1a7a34d107da..8bdbbb113e4ab52556ce292865b84c90e1620402 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3516-helloworld.md @@ -55,7 +55,7 @@ applications/sample/hello ``` 3. 添加新组件。 - 修改文件**build/lite/components/applications.json**,添加组件hello_world_app的配置,如下所示为applications.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): + 修改文件**build/lite/components/communication.json**,添加组件hello_world_app的配置,如下所示为communication.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): ``` diff --git a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md index 023fca41a0925099ea0a94f119e45545f17cfd27..5d2aec5f49af0895e1b5d985a3331beb4481dc0e 100644 --- a/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md +++ b/zh-cn/device-dev/quick-start/quickstart-lite-steps-hi3861-helloworld.md @@ -58,7 +58,7 @@ - include_dirs中指定source所需要依赖的.h文件路径。 4. 添加新组件。 - 修改文件**build/lite/components/applications.json**,添加组件hello_world_app的配置,如下所示为applications.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): + 修改文件**build/lite/components/communication.json**,添加组件hello_world_app的配置,如下所示为communication.json文件片段,"\#\#start\#\#"和"\#\#end\#\#"之间为新增配置("\#\#start\#\#"和"\#\#end\#\#"仅用来标识位置,添加完配置后删除这两行): ``` diff --git a/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md b/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md index d45e6a2ed07e5eaffa4798504a231df1c3c0acde..69b20eac0f29ebf94d3147d192331aa4558a6d6e 100644 --- a/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md @@ -71,7 +71,7 @@ 表5 数据表删除API | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | - | RdbStore | int Delete(int &deletedRows, const AbsRdbPredicates &predicates) | 删除数据。
  • deletedRows:删除的记录条数。
  • predicates:Rdb谓词,指定了删除操作的表名和条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置更新条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
| + | RdbStore | int Delete(int &deletedRows, const AbsRdbPredicates &predicates) | 删除数据。
  • deletedRows:删除的记录条数。
  • predicates:Rdb谓词,指定了删除操作的表名和条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置删除条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
| - 更新 @@ -92,7 +92,7 @@ 表7 数据表查询API | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | - | RdbStore | std::unique_ptr Query(const AbsRdbPredicates &predicates, const std::vector\ columns) | 查询数据。
  • predicates:谓词,可以设置查询条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置更新条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
  • columns:规定查询返回的列。
| + | RdbStore | std::unique_ptr Query(const AbsRdbPredicates &predicates, const std::vector\ columns) | 查询数据。
  • predicates:谓词,可以设置查询条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置查询条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
  • columns:规定查询返回的列。
| | RdbStore | std::unique_ptr QuerySql(const std::string &sql, const std::vector\ &selectionArgs = std::vector\()) | 执行原生的用于查询操作的SQL语句。
  • sql:原生用于查询的sql语句。
  • selectionArgs:sql语句中占位符参数的值,若select语句中没有使用占位符,该参数可以设置为null。
| ### 查询结果集的使用 @@ -129,28 +129,28 @@ 用户根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名。 -表9 根据本地表名获取指定远程设备的分布式表名 +表10 根据本地表名获取指定远程设备的分布式表名 | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | | RdbStore | std::string ObtainDistributedTableName(const std::string& device, const std::string& table) | 根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名。
  • device:远程设备ID
  • table:本地表名
### 在设备之间同步数据 -表10 在设备之间同步数据 +表11 在设备之间同步数据 | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | | RdbStore | bool Sync(const SyncOption& option, const AbsRdbPredicates& predicate, const SyncCallback& callback) | 在设备之间同步数据。
  • option:同步选项;mode:同步模式(PUSH表示数据从本地设备推送到远程设备/PULL表示数据从远程设备拉至本地设备);isBlock:是否阻塞
  • callback:指定的callback回调函数
### 注册数据库的观察者 -表10 注册数据库的观察者 +表12 注册数据库的观察者 | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | | RdbStore | bool Subscribe(const SubscribeOption& option, RdbStoreObserver *observer) | 注册数据库的观察者。当分布式数据库中的数据发生更改时,将调用回调。
  • option:订阅类型;
  • observer:指分布式数据库中数据更改事件的观察者
### 从数据库中删除指定类型的指定观察者 -表10 从数据库中删除指定类型的指定观察者 +表13 从数据库中删除指定类型的指定观察者 | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | | RdbStore | bool UnSubscribe(const SubscribeOption& option, RdbStoreObserver *observer) | 从数据库中删除指定类型的指定观察者。
  • option:订阅类型;
  • observer:指已注册的数据更改观察者
@@ -163,7 +163,7 @@ 关系型数据库提供了备份数据库文件的接口,通过databasePath指定的备份文件名(支持路径)备份当前数据库文件。通过返回值判断是否备份成功,成功时返回0,失败时则返回相应的错误码。 - 表11 数据库备份API + 表14 数据库备份API | 类名 | 接口名 | 描述 | | ---- | ---- | ---- | @@ -173,7 +173,7 @@ 关系型数据库提供了恢复数据库文件的接口,通过backupPath指定的备份文件名(支持路径)恢复当前数据库文件。通过返回值判断是否恢复成功,成功时返回0,失败时则返回相应的错误码。 - 表12 数据库恢复API + 表15 数据库恢复API | 类名 | 接口名 | 描述 | | ---- | ---- | ---- |