提交 aa994dc7 编写于 作者: Y yangliu

Signed-off-by: yangliu <yangliu146@huawei.com>

 Changes to be committed:
	modified:   zh-cn/application-dev/reference/apis/js-apis-data-ability.md
	modified:   zh-cn/application-dev/reference/apis/js-apis-data-rdb.md
	modified:   zh-cn/application-dev/reference/apis/js-apis-data-resultset.md
	modified:   zh-cn/application-dev/reference/apis/js-apis-data-storage.md
	modified:   zh-cn/application-dev/reference/apis/js-apis-distributed-data.md
上级 ef3f6c15
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
import dataAbility from '@ohos.data.dataAbility' import dataAbility from '@ohos.data.dataAbility'
``` ```
## 系统能力
SystemCapability.DistributedDataManager.DataShare.Consumer
## 权限 ## 权限
...@@ -622,7 +624,7 @@ distinct(): DataAbilityPredicates ...@@ -622,7 +624,7 @@ distinct(): DataAbilityPredicates
``` ```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE") let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").distinct("NAME") predicates.equalTo("NAME", "Rose").distinct("NAME")
rdbStore.query(predicates, ["NAME"]) let resultSet = await rdbStore.query(predicates, ["NAME"])
``` ```
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 系统能力
SystemCapability.DistributedDataManager.RelationalStore.Core
## 导入模块 ## 导入模块
...@@ -709,7 +711,7 @@ distinct(): RdbPredicates ...@@ -709,7 +711,7 @@ distinct(): RdbPredicates
``` ```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE") let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").distinct("NAME") predicates.equalTo("NAME", "Rose").distinct("NAME")
rdbStore.query(predicates, ["NAME"]) let resultSet = await rdbStore.query(predicates, ["NAME"])
``` ```
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 系统能力
SystemCapability.DistributedDataManager.RelationalStore.Core
## 使用说明 ## 使用说明
...@@ -14,9 +16,8 @@ let predicates = new dataRdb.RdbPredicates("EMPLOYEE") ...@@ -14,9 +16,8 @@ let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("AGE", 18) predicates.equalTo("AGE", 18)
let promise = rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]) let promise = rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promise.then((resultSet) => { promise.then((resultSet) => {
console.log("resultSet columnNames:" + resultSet.columnNames); await console.log(TAG + "resultSet columnNames:" + resultSet.columnNames);
console.log("resultSet columnCount:" + resultSet.columnCount); await console.log(TAG + "resultSet columnCount:" + resultSet.columnCount);})
})
``` ```
...@@ -115,11 +116,10 @@ goTo(offset:number): boolean ...@@ -115,11 +116,10 @@ goTo(offset:number): boolean
- 示例: - 示例:
``` ```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE") let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => { let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goTo(1); resultSet.goTo(1)
resultSet.close(); resultSet.close()
resultSet = null; resultSet = null
})
``` ```
...@@ -142,11 +142,10 @@ goToRow(position: number): boolean ...@@ -142,11 +142,10 @@ goToRow(position: number): boolean
- 示例: - 示例:
``` ```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE") let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => { let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToRow(1); resultSet.goToRow(1)
resultSet.close(); resultSet.close()
resultSet = null resultSet = null
})
``` ```
...@@ -166,11 +165,10 @@ goToFirstRow(): boolean ...@@ -166,11 +165,10 @@ goToFirstRow(): boolean
- 示例: - 示例:
``` ```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE") let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => { let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToFirstRow(); resultSet.goToFirstRow()
resultSet.close(); resultSet.close()
resultSet = null; resultSet = null;
})
``` ```
...@@ -188,11 +186,10 @@ goToLastRow(): boolean ...@@ -188,11 +186,10 @@ goToLastRow(): boolean
- 示例: - 示例:
``` ```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE") let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => { let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToLastRow(); resultSet.goToLastRow()
resultSet.close(); resultSet.close()
resultSet = null; resultSet = null;
})
``` ```
...@@ -210,11 +207,10 @@ goToNextRow(): boolean ...@@ -210,11 +207,10 @@ goToNextRow(): boolean
- 示例: - 示例:
``` ```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE") let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => { let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToNextRow() resultSet.goToNextRow()
resultSet.close() resultSet.close()
resultSet = null; resultSet = null;
})
``` ```
...@@ -232,11 +228,10 @@ goToPreviousRow(): boolean ...@@ -232,11 +228,10 @@ goToPreviousRow(): boolean
- 示例: - 示例:
``` ```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE") let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => { let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.goToPreviousRow(); resultSet.goToPreviousRow()
resultSet.close(); resultSet.close()
resultSet = null resultSet = null
})
``` ```
...@@ -360,8 +355,7 @@ close(): void ...@@ -360,8 +355,7 @@ close(): void
- 示例: - 示例:
``` ```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE") let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => { let resultSet = await rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
resultSet.close(); resultSet.close()
resultSet = null resultSet = null
})
``` ```
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
import dataStorage from '@ohos.data.storage' import dataStorage from '@ohos.data.storage'
``` ```
## 系统能力
SystemCapability.DistributedDataManager.Preference.Core
## 权限 ## 权限
...@@ -48,13 +51,11 @@ getStorageSync(path: string): Storage ...@@ -48,13 +51,11 @@ getStorageSync(path: string): Storage
import dataStorage from '@ohos.data.storage' import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
(async () => {
var context = featureAbility.getContext() var context = featureAbility.getContext()
var path = await context.getFilesDir() var path = await context.getFilesDir()
let storage = dataStorage.getStorageSync(path + '/mystore') let storage = dataStorage.getStorageSync(path + '/mystore')
storage.putSync('startup', 'auto') storage.putSync('startup', 'auto')
storage.flushSync() storage.flushSync()
})()
``` ```
...@@ -75,7 +76,6 @@ getStorage(path: string, callback: AsyncCallback&lt;Storage&gt;): void ...@@ -75,7 +76,6 @@ getStorage(path: string, callback: AsyncCallback&lt;Storage&gt;): void
import dataStorage from '@ohos.data.storage' import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
(async () => {
var context = featureAbility.getContext() var context = featureAbility.getContext()
var path = await context.getFilesDir() var path = await context.getFilesDir()
dataStorage.getStorage(path + '/mystore', function (err, storage) { dataStorage.getStorage(path + '/mystore', function (err, storage) {
...@@ -86,7 +86,6 @@ getStorage(path: string, callback: AsyncCallback&lt;Storage&gt;): void ...@@ -86,7 +86,6 @@ getStorage(path: string, callback: AsyncCallback&lt;Storage&gt;): void
storage.putSync('startup', 'auto') storage.putSync('startup', 'auto')
storage.flushSync() storage.flushSync()
}) })
})()
``` ```
...@@ -111,7 +110,6 @@ getStorage(path: string): Promise&lt;Storage&gt; ...@@ -111,7 +110,6 @@ getStorage(path: string): Promise&lt;Storage&gt;
import dataStorage from '@ohos.data.storage' import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
(async () => {
var context = featureAbility.getContext() var context = featureAbility.getContext()
var path = await context.getFilesDir() var path = await context.getFilesDir()
let promise = dataStorage.getStorage(path + '/mystore') let promise = dataStorage.getStorage(path + '/mystore')
...@@ -121,7 +119,6 @@ getStorage(path: string): Promise&lt;Storage&gt; ...@@ -121,7 +119,6 @@ getStorage(path: string): Promise&lt;Storage&gt;
}).catch((err) => { }).catch((err) => {
console.info("Get the storage failed, path: " + path + '/mystore') console.info("Get the storage failed, path: " + path + '/mystore')
}) })
}()
``` ```
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
>![](../../public_sys-resources/icon-note.gif) **说明:** >![](../../public_sys-resources/icon-note.gif) **说明:**
>本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 >本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 系统能力
SystemCapability.DistributedDataManager.KVStore.DistributedKVStore
## 导入模块<a name="s56d19203690d4782bfc74069abb6bd71"></a> ## 导入模块<a name="s56d19203690d4782bfc74069abb6bd71"></a>
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册