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 a9cae3a9fcbdbe15657420e851386937e7438b23..27225c724221bc6d201941c6cd309a09a451e225 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
@@ -11,20 +11,19 @@
import data_rdb from '@ohos.data.rdb'
```
-## 系统能力
-SystemCapability.DistributedDataManager.RelationalStore.Core
-
## data_rdb.getRdbStore
-getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void
+getRdbStore(context?: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void
获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,结果以callback形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | context | Context | 是 | 应用程序或功能的上下文 |
+ | context8+ | Context | 是 | 应用程序或功能的上下文 |
| config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 |
| version | number | 是 | 数据库版本。 |
| callback | AsyncCallback<[RdbStore](#rdbstore)> | 是 | 指定callback回调函数。返回一个RdbStore。 |
@@ -45,14 +44,16 @@ getRdbStore(context: Context, config: StoreConfig, version: number, callback: As
## data_rdb.getRdbStore
-getRdbStore(context: Context, config: StoreConfig, version: number): Promise<RdbStore>
+getRdbStore(context?: Context, config: StoreConfig, version: number): Promise<RdbStore>
获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | context | Context | 是 | 应用程序或功能的上下文 |
+ | context8+ | Context | 是 | 应用程序或功能的上下文 |
| config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 |
| version | number | 是 | 数据库版本。 |
@@ -79,14 +80,16 @@ getRdbStore(context: Context, config: StoreConfig, version: number): Promise<
## data_rdb.deleteRdbStore
-deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void
+deleteRdbStore(context?: Context, name: string, callback: AsyncCallback<void>): void
删除数据库,结果以callback形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | context | Context | 是 | 应用程序或功能的上下文 |
+ | context8+ | Context | 是 | 应用程序或功能的上下文 |
| name | string | 是 | 数据库名称。 |
| callback | AsyncCallback<void> | 是 | 指定callback回调函数。如果数据库已删除,则为true;否则返回false。 |
@@ -102,14 +105,16 @@ deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void&g
## data_rdb.deleteRdbStore
-deleteRdbStore(context: Context, name: string): Promise<void>
+deleteRdbStore(context?: Context, name: string): Promise<void>
使用指定的数据库文件配置删除数据库,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | context | Context | 是 | 应用程序或功能的上下文 |
+ | context8+ | Context | 是 | 应用程序或功能的上下文 |
| name | string | 是 | 数据库名称。 |
- 返回值:
@@ -141,6 +146,7 @@ constructor(name: string)
构造函数。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -154,16 +160,17 @@ constructor(name: string)
### inDevices
-inDevices(devices: Array): RdbPredicates;
+inDevices(devices: Array<string>): RdbPredicates
同步分布式数据库时指定组网内的远程设备。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | devices | Array | 是 | 指定的组网内的远程设备ID。 |
+ | devices | Array<string> | 是 | 指定的组网内的远程设备ID。 |
- 返回值:
| 类型 | 说明 |
@@ -176,13 +183,14 @@ inDevices(devices: Array): RdbPredicates;
predicate.inDevices(['12345678abcde'])
```
-### inAllDevices
+### inAllDevices8+
-inAllDevices(): RdbPredicates;
+inAllDevices(): RdbPredicates
同步分布式数据库时连接到组网内的所有远程设备。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 返回值:
| 类型 | 说明 |
@@ -202,6 +210,7 @@ equalTo(field: string, value: ValueType): RdbPredicates
配置谓词以匹配数据字段为ValueType且值等于指定值的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -228,6 +237,7 @@ notEqualTo(field: string, value: ValueType): RdbPredicates
配置谓词以匹配数据字段为ValueType且值不等于指定值的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -254,6 +264,7 @@ beginWrap(): RdbPredicates
向谓词添加左括号。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 返回值:
| 类型 | 说明 |
@@ -279,6 +290,7 @@ endWrap(): RdbPredicates
向谓词添加右括号。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 返回值:
| 类型 | 说明 |
@@ -304,6 +316,7 @@ or(): RdbPredicates
将或条件添加到谓词中。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 返回值:
| 类型 | 说明 |
@@ -326,6 +339,7 @@ and(): RdbPredicates
向谓词添加和条件。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 返回值:
| 类型 | 说明 |
@@ -343,11 +357,11 @@ and(): RdbPredicates
### contains
-contains(field: string, value: string): RdbPredicat
-
+contains(field: string, value: string): RdbPredicates
配置谓词以匹配数据字段为String且value包含指定值的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -374,6 +388,7 @@ beginsWith(field: string, value: string): RdbPredicates
配置谓词以匹配数据字段为String且值以指定字符串开头的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -400,6 +415,7 @@ endsWith(field: string, value: string): RdbPredicates
配置谓词以匹配数据字段为String且值以指定字符串结尾的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -426,6 +442,7 @@ isNull(field: string): RdbPredicates
配置谓词以匹配值为null的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -451,6 +468,7 @@ isNotNull(field: string): RdbPredicates
配置谓词以匹配值不为null的指定字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -476,6 +494,7 @@ like(field: string, value: string): RdbPredicates
配置谓词以匹配数据字段为String且值类似于指定字符串的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -502,6 +521,7 @@ glob(field: string, value: string): RdbPredicates
配置RdbPredicates匹配数据字段为String的指定字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -528,6 +548,7 @@ between(field: string, low: ValueType, high: ValueType): RdbPredicates
将谓词配置为匹配数据字段为ValueType且value在给定范围内的指定字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -555,6 +576,7 @@ notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates
配置RdbPredicates以匹配数据字段为ValueType且value超出给定范围的指定字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -577,11 +599,11 @@ notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates
### greaterThan
-greaterThan(field: string, value: ValueType): RdbPredicatesgr
-
+greaterThan(field: string, value: ValueType): RdbPredicates
配置谓词以匹配数据字段为ValueType且值大于指定值的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -608,6 +630,7 @@ lessThan(field: string, value: ValueType): RdbPredicates
配置谓词以匹配数据字段为valueType且value小于指定值的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -662,6 +685,7 @@ lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates
配置谓词以匹配数据字段为ValueType且value小于或等于指定值的字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -689,6 +713,7 @@ orderByAsc(field: string): RdbPredicates
配置谓词以匹配其值按升序排序的列。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -715,6 +740,7 @@ orderByDesc(field: string): RdbPredicates
配置谓词以匹配其值按降序排序的列。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -740,6 +766,7 @@ distinct(): RdbPredicates
配置谓词以过滤重复记录并仅保留其中一个。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 返回值:
| 类型 | 说明 |
@@ -761,6 +788,7 @@ limitAs(value: number): RdbPredicates
设置最大数据记录数的谓词。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -786,6 +814,7 @@ offsetAs(rowOffset: number): RdbPredicates
配置RdbPredicates以指定返回结果的起始位置。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -811,6 +840,7 @@ groupBy(fields: Array<string>): RdbPredicates
配置RdbPredicates按指定列分组查询结果。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -831,11 +861,11 @@ groupBy(fields: Array<string>): RdbPredicates
### indexedBy
-indexedBy(indexName: string): RdbPredicates
-
+indexedBy(field: string): RdbPredicates
配置RdbPredicates以指定索引列。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -861,6 +891,7 @@ in(field: string, value: Array<ValueType>): RdbPredicates
配置RdbPredicates以匹配数据字段为ValueType数组且值在给定范围内的指定字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -888,6 +919,7 @@ notIn(field: string, value: Array<ValueType>): RdbPredicates
将RdbPredicates配置为匹配数据字段为ValueType且值超出给定范围的指定字段。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -919,6 +951,8 @@ insert(name: string, values: ValuesBucket, callback: AsyncCallback<number>
向目标表中插入一行数据,结果以callback形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -946,6 +980,8 @@ insert(name: string, values: ValuesBucket):Promise<number>
向目标表中插入一行数据,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -978,6 +1014,8 @@ update(values: ValuesBucket, rdbPredicates: RdbPredicates, callback: AsyncCallba
根据RdbPredicates的指定实例对象更新数据库中的数据,结果以callback形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1006,6 +1044,8 @@ update(values: ValuesBucket, rdbPredicates: RdbPredicates):Promise<number>
根据RdbPredicates的指定实例对象更新数据库中的数据,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1041,6 +1081,7 @@ delete(rdbPredicates: RdbPredicates, callback: AsyncCallback<number>):void
根据rdbPredicates的指定实例对象从数据库中删除数据,结果以callback形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
@@ -1063,6 +1104,8 @@ delete(rdbPredicates: RdbPredicates):Promise<number>
根据rdbPredicates的指定实例对象从数据库中删除数据,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1090,6 +1133,8 @@ query(rdbPredicates: RdbPredicates, columns: Array<string>, callback: Asyn
根据指定条件查询数据库中的数据,结果以callback形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1113,6 +1158,8 @@ query(rdbPredicates: RdbPredicates, columns?: Array<string>):Promise<Re
根据指定条件查询数据库中的数据,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1141,6 +1188,8 @@ querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback&
根据指定SQL语句查询数据库中的数据,结果以callback形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1162,6 +1211,8 @@ querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet>
根据指定SQL语句查询数据库中的数据,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1188,6 +1239,8 @@ executeSql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallbac
执行包含指定参数但不返回值的SQL语句,结果以callbck形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1208,6 +1261,8 @@ executeSql(sql: string, bindArgs?: Array<ValueType>):Promise<void>
执行包含指定参数但不返回值的SQL语句,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1226,16 +1281,91 @@ executeSql(sql: string, bindArgs?: Array<ValueType>):Promise<void>
console.info(TAG + 'delete done.')})
```
+### beginTransaction8+
+
+beginTransaction():void
+
+在开始执行SQL语句之前,开始事务。
+
+- 示例:
+```
+ rdbStore.beginTransaction()
+ const valueBucket = {
+ "name": "lisi",
+ "age": 18,
+ "salary": 100.5,
+ "blobType": new Uint8Array([1, 2, 3]),
+ }
+ await rdbStore.insert("test", valueBucket)
+ rdbStore.insert("test", valueBucket, function (err, ret) {
+ expect(1).assertEqual(ret)
+ console.log(TAG + "insert done: " + ret)})
+ rdbStore.commit()
+```
+
+
+### commit8+
+
+commit():void
+
+提交已执行的SQL语句。
+
+- 示例:
+```
+ rdbStore.beginTransaction()
+ const valueBucket = {
+ "name": "lisi",
+ "age": 18,
+ "salary": 100.5,
+ "blobType": new Uint8Array([1, 2, 3]),
+ }
+
+ rdbStore.insert("test", valueBucket, function (err, ret) {
+ expect(1).assertEqual(ret)
+ console.log(TAG + "insert done: " + ret)})
+ rdbStore.commit()
+```
+
+
+### rollBack8+
+
+rollBack():void;
+
+回滚已经执行的SQL语句。
+
+- 示例:
+```
+ try {
+ rdbStore.beginTransaction()
+ const valueBucket = {
+ "id": 1,
+ "name": "lisi",
+ "age": 18,
+ "salary": 100.5,
+ "blobType": new Uint8Array([1, 2, 3]),
+ }
+ rdbStore.insert("test", valueBucket, function (err, ret) {
+ expect(1).assertEqual(ret)
+ console.log(TAG + "insert done: " + ret)})
+ rdbStore.commit()
+ } catch (e) {
+ rdbStore.rollBack()
+ }
+```
+
+
### setDistributedTables
-setDistributedTables(tables: Array, callback: AsyncCallback): void;
+setDistributedTables(tables: Array<string>, callback: AsyncCallback<void>): void
设置分布式列表,结果以callbck形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | tables | Array | 是 | 要设置的分布式列表表名 |
+ | tables | Array<string> | 是 | 要设置的分布式列表表名 |
| callback | AsyncCallback<void> | 是 | 指定callback回调函数。 |
- 示例:
@@ -1252,14 +1382,16 @@ setDistributedTables(tables: Array, callback: AsyncCallback): void
### setDistributedTables
- setDistributedTables(tables: Array): Promise;
+ setDistributedTables(tables: Array<string>): Promise<void>
设置分布式列表,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
- | tables | Array | 是 | 要设置的分布式列表表名。 |
+ | tables | Array<string> | 是 | 要设置的分布式列表表名。 |
- 返回值:
| 类型 | 说明 |
@@ -1278,10 +1410,12 @@ setDistributedTables(tables: Array, callback: AsyncCallback): void
### obtainDistributedTableName
-obtainDistributedTableName(device: string, table: string, callback: AsyncCallback): void;
+obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void
根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 结果以callbck形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1303,10 +1437,12 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac
### obtainDistributedTableName
- obtainDistributedTableName(device: string, table: string): Promise;
+ obtainDistributedTableName(device: string, table: string): Promise<string>
根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1328,12 +1464,14 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac
})
```
-### sync
+### sync8+
-sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback>): void;
+sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback>): void
在设备之间同步数据, 结果以callbck形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1358,12 +1496,14 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback8+
- sync(mode: SyncMode, predicates: RdbPredicates): Promise>;
+ sync(mode: SyncMode, predicates: RdbPredicates): Promise<Array<[string, number]>>
在设备之间同步数据,结果以Promise形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
@@ -1373,7 +1513,7 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback> | 指定Promise回调函数,用于向调用者发送同步结果。string:设备ID;number:每个设备同步状态,0表示成功,其他值表示失败。 |
+ | Promise<Array<[string, number]>> | 指定Promise回调函数,用于向调用者发送同步结果。string:设备ID;number:每个设备同步状态,0表示成功,其他值表示失败。 |
- 示例:
```
@@ -1392,15 +1532,17 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback>): void;
+on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void
注册数据库的观察者。当分布式数据库中的数据发生更改时,将调用回调。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | SubscribeType | 是 | 指在{@code SubscribeType}中定义的订阅类型。 |
- | observer | Callback> | 是 | 指分布式数据库中数据更改事件的观察者。 |
+ | observer | Callback<Array<string>> | 是 | 指分布式数据库中数据更改事件的观察者。 |
- 示例:
```
@@ -1418,15 +1560,17 @@ on(event: 'dataChange', type: SubscribeType, observer: Callback>):
### off
-off(event:'dataChange', type: SubscribeType, observer: Callback>): void;
+off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void
从数据库中删除指定类型的指定观察者, 结果以callbck形式返回。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
- 参数:
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| type | SubscribeType | 是 | 指在{@code SubscribeType}中定义的订阅类型。 |
- | observer | Callback> | 是 | 指已注册的数据更改观察者。|
+ | observer | Callback<Array<string>> | 是 | 指已注册的数据更改观察者。|
- 示例:
```
@@ -1447,6 +1591,8 @@ off(event:'dataChange', type: SubscribeType, observer: Callback>):
管理关系数据库配置。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| name | string | 是 | 数据库文件名。 |
@@ -1456,6 +1602,8 @@ off(event:'dataChange', type: SubscribeType, observer: Callback>):
用于表示允许的数据字段类型。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
| 名称 | 说明 |
| -------- | -------- |
| number | 表示值类型为数字。 |
@@ -1467,25 +1615,30 @@ off(event:'dataChange', type: SubscribeType, observer: Callback>):
用于存储键值对。
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
| 名称 | 参数类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| [key: string] | [ValueType](#valuetype)\| Uint8Array \| null | 是 | 用于存储键值对。 |
-## SyncMode
+## SyncMode8+
指数据库同步模式。
-| 名称 | 说明 |
-| -------- | -------- |
-| SYNC_MODE_PUSH | 表示数据从本地设备推送到远程设备。 |
-| SYNC_MODE_PULL | 表示数据从远程设备拉至本地设备。 |
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
-## SubscribeType
+| 名称 | 默认值 | 说明 |
+| -------- | ----- |----- |
+| SYNC_MODE_PUSH | 0 | 表示数据从本地设备推送到远程设备。 |
+| SYNC_MODE_PULL | 1 | 表示数据从远程设备拉至本地设备。 |
+
+## SubscribeType8+
描述订阅类型。
-| 名称 | 说明 |
-| -------- | -------- |
-| SUBSCRIBE_TYPE_REMOTE | 订阅远程数据更改。 |
+**系统能力**:以下各项对应的系统能力均为SystemCapability.DistributedDataManager.RelationalStore.Core。
+
+| 名称 | 默认值 | 说明 |
+| -------- | ----- |---- |
+| SUBSCRIBE_TYPE_REMOTE | 0 | 订阅远程数据更改。 |