未验证 提交 75ceea51 编写于 作者: O openharmony_ci 提交者: Gitee

!1495 增加系统能力

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