Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
b48c0c19
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
b48c0c19
编写于
9月 24, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
!9818 [翻译完成】#I5P1O9(格式和代码刷新,未涉及翻译)
Merge pull request !9818 from Annie_wang/PR8950
上级
9ca8c90c
5af39aab
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
82 addition
and
88 deletion
+82
-88
en/application-dev/reference/apis/js-apis-data-ability.md
en/application-dev/reference/apis/js-apis-data-ability.md
+82
-88
未找到文件。
en/application-dev/reference/apis/js-apis-data-ability.md
浏览文件 @
b48c0c19
...
...
@@ -13,13 +13,10 @@
import
dataAbility
from
'
@ohos.data.dataAbility
'
;
```
## dataAbility.createRdbPredicates
createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates
Creates an
**RdbPredicates**
object from a
**DataAbilityPredicates**
object.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
...
...
@@ -32,93 +29,93 @@ Creates an **RdbPredicates** object from a **DataAbilityPredicates** object.
| dataAbilityPredicates |
[
DataAbilityPredicates
](
#dataabilitypredicates
)
| Yes|
**DataAbilityPredicates**
object. |
**Return value**
| Type| Description|
| -------- | -------- |
| rdb.
[
RdbPredicates
](
js-apis-data-rdb.md#rdbpredicates
)
|
**RdbPredicates**
object created.|
**Example**
```
js
let
dataAbilityPredicates
=
new
dataAbility
.
DataAbilityPredicates
()
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
Rose
"
)
.
between
(
"
AGE
"
,
16
,
30
)
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
Rose
"
)
let
predicates
=
dataAbility
.
createRdbPredicates
(
"
EMPLOYEE
"
,
dataAbilityPredicates
)
```
## DataAbilityPredicates
Provides predicates for implementing diverse query methods.
### equalTo
equalTo(field: string, value: ValueType): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field with data type
**ValueType**
and value equal to the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value |
[
ValueType
](
#valuetype
)
| Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
lisi
"
)
```
### notEqualTo
notEqualTo(field: string, value: ValueType): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field with data type
**ValueType**
and value not equal to the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value |
[
ValueType
](
#valuetype
)
| Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
notEqualTo
(
"
NAME
"
,
"
lisi
"
)
```
### beginWrap
beginWrap(): DataAbilityPredicates
Adds a left parenthesis to this
**DataAbilityPredicates**
.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object with a left parenthesis.|
**Example**
```
js
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
lisi
"
)
.
beginWrap
()
...
...
@@ -128,23 +125,22 @@ Adds a left parenthesis to this **DataAbilityPredicates**.
.
endWrap
()
```
### endWrap
endWrap(): DataAbilityPredicates
Adds a right parenthesis to this
**DataAbilityPredicates**
.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object with a right parenthesis.|
**Example**
```
js
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
lisi
"
)
.
beginWrap
()
...
...
@@ -154,251 +150,247 @@ Adds a right parenthesis to this **DataAbilityPredicates**.
.
endWrap
()
```
### or
or(): DataAbilityPredicates
Adds the OR condition to this
**DataAbilityPredicates**
.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object with the OR condition.|
**Example**
```
js
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
Lisa
"
)
.
or
()
.
equalTo
(
"
NAME
"
,
"
Rose
"
)
```
### and
and(): DataAbilityPredicates
Adds the AND condition to this
**DataAbilityPredicates**
.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object with the AND condition.|
**Example**
```
js
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
Lisa
"
)
.
and
()
.
equalTo
(
"
SALARY
"
,
200.5
)
```
### contains
contains(field: string, value: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match a string containing the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value | string | Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
contains
(
"
NAME
"
,
"
os
"
)
```
### beginsWith
beginsWith(field: string, value: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match a string that starts with the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value | string | Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
beginsWith
(
"
NAME
"
,
"
os
"
)
```
### endsWith
endsWith(field: string, value: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match a string that ends with the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value | string | Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
dataAbilityPredicates.endsWith("NAME", "se")
```
### isNull
isNull(field: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field whose value is null.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
isNull
(
"
NAME
"
)
```
### isNotNull
isNotNull(field: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field whose value is not null.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
isNotNull
(
"
NAME
"
)
```
### like
like(field: string, value: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match a string that is similar to the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value | string | Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
like
(
"
NAME
"
,
"
%os%
"
)
```
### glob
glob(field: string, value: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the specified string.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value | string | Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
glob
(
"
NAME
"
,
"
?h*g
"
)
```
### between
between(field: string, low: ValueType, high: ValueType): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match a field whose data type is
**ValueType**
and value is within the specified range.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
...
...
@@ -406,27 +398,27 @@ Sets a **DataAbilityPredicates** object to match a field whose data type is **Va
| high |
[
ValueType
](
#valuetype
)
| Yes| Maximum value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
between
(
"
AGE
"
,
10
,
50
)
```
### notBetween
notBetween(field: string, low: ValueType, high: ValueType): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field with data type
**ValueType**
and value out of the specified range.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
...
...
@@ -434,244 +426,245 @@ Sets a **DataAbilityPredicates** object to match the field with data type **Valu
| high |
[
ValueType
](
#valuetype
)
| Yes| Maximum value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
notBetween
(
"
AGE
"
,
10
,
50
)
```
### greaterThan
greaterThan(field: string, value: ValueType): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field with data type
**ValueType**
and value greater than the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value |
[
ValueType
](
#valuetype
)
| Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
greaterThan
(
"
AGE
"
,
18
)
```
### lessThan
lessThan(field: string, value: ValueType): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field with data type
**ValueType**
and value less than the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value |
[
ValueType
](
#valuetype
)
| Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
lessThan
(
"
AGE
"
,
20
)
```
### greaterThanOrEqualTo
greaterThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field with data type
**ValueType**
and value greater than or equal to the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value |
[
ValueType
](
#valuetype
)
| Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
greaterThanOrEqualTo
(
"
AGE
"
,
18
)
```
### lessThanOrEqualTo
lessThanOrEqualTo(field: string, value: ValueType): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field with data type
**ValueType**
and value less than or equal to the specified value.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value |
[
ValueType
](
#valuetype
)
| Yes| Value to match the
**DataAbilityPredicates**
.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
lessThanOrEqualTo
(
"
AGE
"
,
20
)
```
### orderByAsc
orderByAsc(field: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the column with values sorted in ascending order.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
orderByAsc
(
"
NAME
"
)
```
### orderByDesc
orderByDesc(field: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the column with values sorted in descending order.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
orderByDesc
(
"
AGE
"
)
```
### distinct
distinct(): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to filter out duplicate records.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that can filter out duplicate records.|
**Example**
```
js
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
Rose
"
).
distinct
()
```
### limitAs
limitAs(value: number): DataAbilityPredicates
Set a
**DataAbilityPredicates**
object to specify the maximum number of records.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | number | Yes| Maximum number of records.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that specifies the maximum number of records.|
**Example**
```
js
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
Rose
"
).
limitAs
(
3
)
```
### offsetAs
offsetAs(rowOffset: number): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to specify the start position of the returned result.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rowOffset | number | Yes| Number of rows to offset from the beginning. The value is a positive integer.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that specifies the start position of the returned result.|
**Example**
```
js
dataAbilityPredicates
.
equalTo
(
"
NAME
"
,
"
Rose
"
).
offsetAs
(
3
)
```
...
...
@@ -679,66 +672,66 @@ Sets a **DataAbilityPredicates** object to specify the start position of the ret
### groupBy
groupBy(fields: Array
<
string
>
): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to group rows that have the same value into summary rows.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| fields | Array
<
string
>
| Yes| Names of columns to group.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that groups rows with the same value.|
**Example**
```
js
dataAbilityPredicates
.
groupBy
([
"
AGE
"
,
"
NAME
"
])
```
### indexedBy
indexedBy(field: string): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to specify the index column.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| indexName | string | Yes| Name of the index column.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that specifies the index column.|
**Example**
```
js
dataAbilityPredicates
.
indexedBy
(
"
SALARY_INDEX
"
)
```
### in
in(field: string, value: Array
<
ValueType
>
): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field with data type Array
<ValueType>
and value within the specified range.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
...
...
@@ -746,39 +739,40 @@ Sets a **DataAbilityPredicates** object to match the field with data type Array<
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
in
(
"
AGE
"
,
[
18
,
20
])
```
### notIn
notIn(field: string, value: Array
<
ValueType
>
): DataAbilityPredicates
Sets a
**DataAbilityPredicates**
object to match the field with data type Array
<ValueType>
and value out of the specified range.
**System capability**
: SystemCapability.DistributedDataManager.DataShare.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the table.|
| value | Array
<
[ValueType](#valuetype)
>
| Yes| Array of
**ValueType**
s to match.|
**Return value**
| Type| Description|
| -------- | -------- |
|
[
DataAbilityPredicates
](
#dataabilitypredicates
)
|
**DataAbilityPredicates**
object that matches the specified field.|
**Example**
```
js
dataAbilityPredicates
.
notIn
(
"
NAME
"
,
[
"
Lisa
"
,
"
Rose
"
])
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录