diff --git a/zh-cn/application-dev/database/database-distributedobject-guidelines.md b/zh-cn/application-dev/database/database-distributedobject-guidelines.md index 5b74de768c4e3c98c941b9a5b4d9079408a9a6b5..eda575e3327189de973e83aa53d5b56267910b3a 100644 --- a/zh-cn/application-dev/database/database-distributedobject-guidelines.md +++ b/zh-cn/application-dev/database/database-distributedobject-guidelines.md @@ -15,7 +15,7 @@ **表1** 分布式数据对象实例创建接口 | 包名 | 接口名 | 描述 | | -------- | -------- | -------- | -| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | 创建一个分布式数据对象实例,用于数据操作 | +| ohos.data.distributedDataObject| createDistributedObject(source: object): DistributedObject | 创建一个分布式数据对象实例,用于数据操作
- source:设置distributedObject的属性。
- DistributedObject:返回值是创建好的分布式对象。| ### 创建分布式数据对象sessionId @@ -33,7 +33,7 @@ **表3** 分布式数据对象sessionId设置接口 | 类名 | 接口名 | 描述 | | -------- | -------- | -------- | -| DistributedDataObject | setSessionId(sessionId?: string): boolean | 为分布式数据对象设置sessionId | +| DistributedDataObject | setSessionId(sessionId?: string): boolean | 为分布式数据对象设置sessionId
- sessionId:分布式数据对象sessionId。| ### 订阅数据变更 @@ -43,7 +43,7 @@ | 类名 | 接口名 | 描述 | | -------- | -------- | -------- | | DistributedDataObject| on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<string> }>): void | 订阅数据变更。 | -| DistributedDataObject| off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array<string> }>): void | 注销订阅。 | +| DistributedDataObject| off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array<string> }>): void | 注销订阅。如果写了Callback为注销某个订阅,不写Callback为注销所有订阅 | ### 订阅数据对象上下线 @@ -83,12 +83,12 @@ //发起方 var local_object = distributedObject.createDistributedObject({name:"jack", age:18, isVis:true, parent:{mother:"jack mom",father:"jack Dad"},[{mother:"jack mom"}, {father:"jack Dad"}]}; - local_object.setsessionId(sessionId); + local_object.setSessionId(sessionId); - //被发起方 + //被拉起方 var remote_object = distributedObject.createDistributedObject({name:undefined, age:undefined, isVis:true, parent:undefined, list:undefined}); - remote_object.setsessionId(sessionId); + remote_object.setSessionId(sessionId); //收到status上线后remote_object同步数据,即name变成jack,age是18 ``` diff --git a/zh-cn/application-dev/database/database-relational-guidelines.md b/zh-cn/application-dev/database/database-relational-guidelines.md index 360dc328abbffe62fd68f4900437d91a83117c95..a30a5d0d158ac016eb3659389482a59302e0dca2 100644 --- a/zh-cn/application-dev/database/database-relational-guidelines.md +++ b/zh-cn/application-dev/database/database-relational-guidelines.md @@ -207,12 +207,12 @@ 示例代码如下: ``` - import dataRdb from '@ohos.data.rdb'; + import data_rdb from '@ohos.data.rdb' const CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)"; const STORE_CONFIG = {name: "rdbstore.db",} - let rdbStore = await dataRdb.getRdbStore(STORE_CONFIG, 1); + let rdbStore = await data_rdb.getRdbStore(STORE_CONFIG, 1); await rdbStore.executeSql(CREATE_TABLE_TEST); ``` @@ -236,7 +236,7 @@ 示例代码如下: ``` - let predicates = new dataRdb.RdbPredicates("test"); + let predicates = new data_rdb.RdbPredicates("test"); predicates.equalTo("name", "Tom") let resultSet = await rdbStore.query(predicates) @@ -273,7 +273,7 @@ 示例代码如下: ``` - let predicate = new dataRdb.RdbPredicates('test') + let predicate = new data_rdb.RdbPredicates('test') predicate.inDevices(['12345678abcde']) let promise = rdbStore.sync(rdb.SyncMode.SYNC_MODE_PUSH, predicate) promise.then(result) {