提交 5f135b38 编写于 作者: A annie_wangli

update docs

Signed-off-by: Nannie_wangli <annie.wangli@huawei.com>
上级 fcbcccd5
# DataAbilityPredicates<a name="EN-US_TOPIC_0000001201117411"></a>
# DataAbilityPredicates
>![](../../public_sys-resources/icon-note.gif) **NOTE**
>
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import<a name="section68088407422"></a>
## Modules to Import
```
import dataAbility from '@ohos.data.dataAbility'
```
## System Capabilities
SystemCapability.DistributedDataManager.DataShare.Core
## dataAbility.createRdbPredicates<a name="section039731125514"></a>
createRdbPredicates\(name: string, dataAbilityPredicates: DataAbilityPredicates\): rdb.RdbPredicates
Creates an **RdbPredicates** object based on a **DataAabilityPredicates** object.
- Parameters
<a name="table616003193611"></a>
<table><thead align="left"><tr id="row1316020312365"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p616063133616"><a name="p616063133616"></a><a name="p616063133616"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1416118313611"><a name="p1416118313611"></a><a name="p1416118313611"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p516113318361"><a name="p516113318361"></a><a name="p516113318361"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p131616353614"><a name="p131616353614"></a><a name="p131616353614"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row816113313611"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p13161938361"><a name="p13161938361"></a><a name="p13161938361"></a>name</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p5162123173618"><a name="p5162123173618"></a><a name="p5162123173618"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p10162163203617"><a name="p10162163203617"></a><a name="p10162163203617"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1816220320362"><a name="p1816220320362"></a><a name="p1816220320362"></a>Table name in the RDB store.</p>
</td>
</tr>
<tr id="row51631638365"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p1516323143611"><a name="p1516323143611"></a><a name="p1516323143611"></a>dataAbilityPredicates</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p616313383615"><a name="p616313383615"></a><a name="p616313383615"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p41638363611"><a name="p41638363611"></a><a name="p41638363611"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1616315393610"><a name="p1616315393610"></a><a name="p1616315393610"></a><strong id="b1173944813210"><a name="b1173944813210"></a><a name="b1173944813210"></a>DataAbilityPredicates</strong> object.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table4192203119407"></a>
<table><thead align="left"><tr id="row151921531124013"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p111928310403"><a name="p111928310403"></a><a name="p111928310403"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p21931331194016"><a name="p21931331194016"></a><a name="p21931331194016"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row11935314406"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p14805164434011"><a name="p14805164434011"></a><a name="p14805164434011"></a>rdb.<a href="js-apis-data-rdb.md#section3101161234310">RdbPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p152193512554"><a name="p152193512554"></a><a name="p152193512554"></a><strong id="b15347131762012"><a name="b15347131762012"></a><a name="b15347131762012"></a>RdbPredicates</strong> object created.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let dataAbilityPredicates = new dataAbility.DataAbilityPredicates()
dataAbilityPredicates.equalTo("NAME", "Rose").between("AGE", 16, 30)
let predicates = dataAbility.createRdbPredicates("EMPLOYEE", dataAbilityPredicates)
```
## DataAbilityPredicates<a name="section55051094515"></a>
## dataAbility.createRdbPredicates
createRdbPredicates(name: string, dataAbilityPredicates: DataAbilityPredicates): rdb.RdbPredicates
Creates an **RdbPredicates** object based on a **DataAabilityPredicates** object.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Table name in the RDB store.|
| dataAbilityPredicates | [DataAbilityPredicates](#dataabilitypredicates) | Yes| **DataAbilityPredicates** object.|
- Return value
| Type| Description|
| -------- | -------- |
| rdb.[RdbPredicates](js-apis-data-rdb.md#rdbpredicates) | **RdbPredicates** object created.|
- Example:
```
let dataAbilityPredicates = new dataAbility.DataAbilityPredicates()
dataAbilityPredicates.equalTo("NAME", "Rose").between("AGE", 16, 30)
let predicates = dataAbility.createRdbPredicates("EMPLOYEE", dataAbilityPredicates)
```
## DataAbilityPredicates
Provides predicates for implementing diverse query methods.
### equalTo<a name="section2198018183"></a>
equalTo\(field: string, value: ValueType\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **ValueType** and value equal to the specified value.
- Parameters
<a name="table199461128125613"></a>
<table><thead align="left"><tr id="row1794762812569"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p8947128125618"><a name="p8947128125618"></a><a name="p8947128125618"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p199472028175610"><a name="p199472028175610"></a><a name="p199472028175610"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p69475284563"><a name="p69475284563"></a><a name="p69475284563"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p7948152819564"><a name="p7948152819564"></a><a name="p7948152819564"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row159484286561"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p9613184065619"><a name="p9613184065619"></a><a name="p9613184065619"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p19481828115617"><a name="p19481828115617"></a><a name="p19481828115617"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p39481528165612"><a name="p39481528165612"></a><a name="p39481528165612"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p13948172810562"><a name="p13948172810562"></a><a name="p13948172810562"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row35449501565"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p5545155065620"><a name="p5545155065620"></a><a name="p5545155065620"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1454575075612"><a name="p1454575075612"></a><a name="p1454575075612"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p165455508567"><a name="p165455508567"></a><a name="p165455508567"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p354665035618"><a name="p354665035618"></a><a name="p354665035618"></a>Value to match the <strong id="b1962273017112"><a name="b1962273017112"></a><a name="b1962273017112"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table051813246573"></a>
<table><thead align="left"><tr id="row8518724125714"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p65186247578"><a name="p65186247578"></a><a name="p65186247578"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p65181324105720"><a name="p65181324105720"></a><a name="p65181324105720"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1151918245578"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p2017012187205"><a name="p2017012187205"></a><a name="p2017012187205"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p1551922465710"><a name="p1551922465710"></a><a name="p1551922465710"></a><strong id="b730242641812"><a name="b730242641812"></a><a name="b730242641812"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "lisi")
```
### notEqualTo<a name="section2090013451815"></a>
notEqualTo\(field: string, value: ValueType\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **ValueType** and value not equal to the specified value.
- Parameters
<a name="table17531173816514"></a>
<table><thead align="left"><tr id="row953113819510"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p8531838659"><a name="p8531838659"></a><a name="p8531838659"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p553112388513"><a name="p553112388513"></a><a name="p553112388513"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p6531133810511"><a name="p6531133810511"></a><a name="p6531133810511"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1853293814512"><a name="p1853293814512"></a><a name="p1853293814512"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1053213388510"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p14532153810516"><a name="p14532153810516"></a><a name="p14532153810516"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p195322380510"><a name="p195322380510"></a><a name="p195322380510"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p3532103816512"><a name="p3532103816512"></a><a name="p3532103816512"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p16532133810511"><a name="p16532133810511"></a><a name="p16532133810511"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row2532103810512"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p105321238052"><a name="p105321238052"></a><a name="p105321238052"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p15323381156"><a name="p15323381156"></a><a name="p15323381156"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p15331386514"><a name="p15331386514"></a><a name="p15331386514"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p5533103820515"><a name="p5533103820515"></a><a name="p5533103820515"></a>Value to match the <strong id="b18745434587"><a name="b18745434587"></a><a name="b18745434587"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table9811361768"></a>
<table><thead align="left"><tr id="row15811961668"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p88111567612"><a name="p88111567612"></a><a name="p88111567612"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p68111661263"><a name="p68111661263"></a><a name="p68111661263"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row108111563614"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p5812667615"><a name="p5812667615"></a><a name="p5812667615"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p138121962619"><a name="p138121962619"></a><a name="p138121962619"></a><strong id="b1950194716119"><a name="b1950194716119"></a><a name="b1950194716119"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.notEqualTo("NAME", "lisi")
```
### beginWrap<a name="section15372052110"></a>
beginWrap\(\): DataAbilityPredicates
Adds a left parenthesis to this **DataAbilityPredicates**.
- Return values
<a name="table8798182141219"></a>
<table><thead align="left"><tr id="row1879811211210"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1879972111212"><a name="p1879972111212"></a><a name="p1879972111212"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1779932121212"><a name="p1779932121212"></a><a name="p1779932121212"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row157994291219"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p8799202171212"><a name="p8799202171212"></a><a name="p8799202171212"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p177999216128"><a name="p177999216128"></a><a name="p177999216128"></a><strong id="b24143113146"><a name="b24143113146"></a><a name="b24143113146"></a>DataAbilityPredicates</strong> object with a left parenthesis.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbilitylity.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "lisi")
.beginWrap()
.equalTo("AGE", 18)
.or()
.equalTo("SALARY", 200.5)
.endWrap()
```
### endWrap<a name="section830315118589"></a>
endWrap\(\): DataAbilityPredicates
Adds a right parenthesis to this **DataAbilityPredicates**.
- Return values
<a name="table1345521812144"></a>
<table><thead align="left"><tr id="row2455201812143"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1045631810147"><a name="p1045631810147"></a><a name="p1045631810147"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p245631813147"><a name="p245631813147"></a><a name="p245631813147"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1045610186147"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p144569181148"><a name="p144569181148"></a><a name="p144569181148"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p12457141812149"><a name="p12457141812149"></a><a name="p12457141812149"></a><strong id="b17309163191514"><a name="b17309163191514"></a><a name="b17309163191514"></a>DataAbilityPredicates</strong> object with a right parenthesis.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "lisi")
.beginWrap()
.equalTo("AGE", 18)
.or()
.equalTo("SALARY", 200.5)
.endWrap()
```
### or<a name="section12206854306"></a>
or\(\): DataAbilityPredicates
Adds the OR condition to this **DataAbilityPredicates**.
- Return values
<a name="table6746132913152"></a>
<table><thead align="left"><tr id="row1374711292154"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p574715292152"><a name="p574715292152"></a><a name="p574715292152"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p17481429111515"><a name="p17481429111515"></a><a name="p17481429111515"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row12748202911154"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p6748102911513"><a name="p6748102911513"></a><a name="p6748102911513"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p1574882991512"><a name="p1574882991512"></a><a name="p1574882991512"></a><strong id="b853713232154"><a name="b853713232154"></a><a name="b853713232154"></a>DataAbilityPredicates</strong> object with the OR condition.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Lisa")
.or()
.equalTo("NAME", "Rose")
```
### and<a name="section33535342114"></a>
and\(\): DataAbilityPredicates
Adds the AND condition to this **DataAbilityPredicates**.
- Return values
<a name="table11147145951616"></a>
<table><thead align="left"><tr id="row1914785918165"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p21471559101610"><a name="p21471559101610"></a><a name="p21471559101610"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p8147175918161"><a name="p8147175918161"></a><a name="p8147175918161"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row111479594161"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p18147175915168"><a name="p18147175915168"></a><a name="p18147175915168"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p13148165911612"><a name="p13148165911612"></a><a name="p13148165911612"></a><strong id="b3484124211518"><a name="b3484124211518"></a><a name="b3484124211518"></a>DataAbilityPredicates</strong> with the AND condition.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Lisa")
.and()
.equalTo("SALARY", 200.5)
```
### contains<a name="section18316219823"></a>
contains\(field: string, value: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match a string containing the specified value.
- Parameters
<a name="table99541451811"></a>
<table><thead align="left"><tr id="row1695514191816"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p79554416187"><a name="p79554416187"></a><a name="p79554416187"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1295511491810"><a name="p1295511491810"></a><a name="p1295511491810"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p119555414180"><a name="p119555414180"></a><a name="p119555414180"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p109554410181"><a name="p109554410181"></a><a name="p109554410181"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1295511416188"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p20955174111810"><a name="p20955174111810"></a><a name="p20955174111810"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1956164101819"><a name="p1956164101819"></a><a name="p1956164101819"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p199560411183"><a name="p199560411183"></a><a name="p199560411183"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1595612471811"><a name="p1595612471811"></a><a name="p1595612471811"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row7956114121815"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p695615451819"><a name="p695615451819"></a><a name="p695615451819"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p129801018122018"><a name="p129801018122018"></a><a name="p129801018122018"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p1957445181"><a name="p1957445181"></a><a name="p1957445181"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p595711461816"><a name="p595711461816"></a><a name="p595711461816"></a>Value to match the <strong id="b47493314587"><a name="b47493314587"></a><a name="b47493314587"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table17360223196"></a>
<table><thead align="left"><tr id="row167361522161912"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p197362022111910"><a name="p197362022111910"></a><a name="p197362022111910"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p7736722151913"><a name="p7736722151913"></a><a name="p7736722151913"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row187372229192"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p17737162216194"><a name="p17737162216194"></a><a name="p17737162216194"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p773782281911"><a name="p773782281911"></a><a name="p773782281911"></a><strong id="b131651530132111"><a name="b131651530132111"></a><a name="b131651530132111"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.contains("NAME", "os")
```
### beginsWith<a name="section1976125011217"></a>
beginsWith\(field: string, value: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match a string that starts with the specified value.
- Parameters
<a name="table13588185517222"></a>
<table><thead align="left"><tr id="row858985542212"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p18589555122218"><a name="p18589555122218"></a><a name="p18589555122218"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p19589255122217"><a name="p19589255122217"></a><a name="p19589255122217"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p1258925512214"><a name="p1258925512214"></a><a name="p1258925512214"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1658919555225"><a name="p1658919555225"></a><a name="p1658919555225"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row959014558220"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p155906556229"><a name="p155906556229"></a><a name="p155906556229"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1659015542216"><a name="p1659015542216"></a><a name="p1659015542216"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p135905552227"><a name="p135905552227"></a><a name="p135905552227"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p35911455102217"><a name="p35911455102217"></a><a name="p35911455102217"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row459115518229"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p11591175562211"><a name="p11591175562211"></a><a name="p11591175562211"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p16591115514221"><a name="p16591115514221"></a><a name="p16591115514221"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p059135519222"><a name="p059135519222"></a><a name="p059135519222"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1059215555223"><a name="p1059215555223"></a><a name="p1059215555223"></a>Value to match the <strong id="b67514335813"><a name="b67514335813"></a><a name="b67514335813"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table35926554222"></a>
<table><thead align="left"><tr id="row959216553223"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1659235592214"><a name="p1659235592214"></a><a name="p1659235592214"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p3593855192215"><a name="p3593855192215"></a><a name="p3593855192215"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row13593655102212"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p9593135542210"><a name="p9593135542210"></a><a name="p9593135542210"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p19594135515224"><a name="p19594135515224"></a><a name="p19594135515224"></a><strong id="b1616813013217"><a name="b1616813013217"></a><a name="b1616813013217"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.beginsWith("NAME", "os")
```
### endsWith<a name="section202091222412"></a>
endsWith\(field: string, value: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match a string that ends with the specified value.
- Parameters
<a name="table959074252519"></a>
<table><thead align="left"><tr id="row85911342122517"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p1859194292517"><a name="p1859194292517"></a><a name="p1859194292517"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1959154272515"><a name="p1959154272515"></a><a name="p1959154272515"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p359119428254"><a name="p359119428254"></a><a name="p359119428254"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p559217421253"><a name="p559217421253"></a><a name="p559217421253"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row155921242102515"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p859254222516"><a name="p859254222516"></a><a name="p859254222516"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p175921242132511"><a name="p175921242132511"></a><a name="p175921242132511"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p259244262510"><a name="p259244262510"></a><a name="p259244262510"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p17593942142517"><a name="p17593942142517"></a><a name="p17593942142517"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row155936421254"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p8593342102517"><a name="p8593342102517"></a><a name="p8593342102517"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p4593124216259"><a name="p4593124216259"></a><a name="p4593124216259"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p1594194215256"><a name="p1594194215256"></a><a name="p1594194215256"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p059434232511"><a name="p059434232511"></a><a name="p059434232511"></a>Value to match the <strong id="b67545317584"><a name="b67545317584"></a><a name="b67545317584"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table1659594211251"></a>
<table><thead align="left"><tr id="row1359574213251"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p13595042142511"><a name="p13595042142511"></a><a name="p13595042142511"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p7595184215257"><a name="p7595184215257"></a><a name="p7595184215257"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row2595242172511"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p1959684214259"><a name="p1959684214259"></a><a name="p1959684214259"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p759664212259"><a name="p759664212259"></a><a name="p759664212259"></a><strong id="b51701930142112"><a name="b51701930142112"></a><a name="b51701930142112"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.endsWith("NAME", "se")
```
### isNull<a name="section208566591645"></a>
isNull\(field: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field whose value is **null**.
- Parameters
<a name="table11961102414270"></a>
<table><thead align="left"><tr id="row8962124162717"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p11962724132712"><a name="p11962724132712"></a><a name="p11962724132712"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1896392492719"><a name="p1896392492719"></a><a name="p1896392492719"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p14963424192720"><a name="p14963424192720"></a><a name="p14963424192720"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1296320244279"><a name="p1296320244279"></a><a name="p1296320244279"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row11963024142713"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p14964172432718"><a name="p14964172432718"></a><a name="p14964172432718"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p119642248272"><a name="p119642248272"></a><a name="p119642248272"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p1996452416274"><a name="p1996452416274"></a><a name="p1996452416274"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1996411246271"><a name="p1996411246271"></a><a name="p1996411246271"></a>Column name in the database table.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table1496672416277"></a>
<table><thead align="left"><tr id="row796615244274"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p199662242279"><a name="p199662242279"></a><a name="p199662242279"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p10966172416274"><a name="p10966172416274"></a><a name="p10966172416274"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row129671724102719"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p49671324162710"><a name="p49671324162710"></a><a name="p49671324162710"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p796713249277"><a name="p796713249277"></a><a name="p796713249277"></a><strong id="b1417353020217"><a name="b1417353020217"></a><a name="b1417353020217"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.isNull("NAME")
```
### isNotNull<a name="section108675461514"></a>
isNotNull\(field: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field whose value is not **null**.
- Parameters
<a name="table328791393015"></a>
<table><thead align="left"><tr id="row162888138309"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p1528811316306"><a name="p1528811316306"></a><a name="p1528811316306"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1428861319309"><a name="p1428861319309"></a><a name="p1428861319309"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p19288151303015"><a name="p19288151303015"></a><a name="p19288151303015"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p828913133307"><a name="p828913133307"></a><a name="p828913133307"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row14289713193020"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p11289131319304"><a name="p11289131319304"></a><a name="p11289131319304"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p728991363013"><a name="p728991363013"></a><a name="p728991363013"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p82902135309"><a name="p82902135309"></a><a name="p82902135309"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1529081319307"><a name="p1529081319307"></a><a name="p1529081319307"></a>Column name in the database table.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table18290101383017"></a>
<table><thead align="left"><tr id="row1129141353017"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1629191310307"><a name="p1629191310307"></a><a name="p1629191310307"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1829131310305"><a name="p1829131310305"></a><a name="p1829131310305"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row029281323011"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p17292713173018"><a name="p17292713173018"></a><a name="p17292713173018"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p15292171319302"><a name="p15292171319302"></a><a name="p15292171319302"></a><strong id="b1117533092115"><a name="b1117533092115"></a><a name="b1117533092115"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.isNotNull("NAME")
```
### like<a name="section11923221863"></a>
like\(field: string, value: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match a string that is similar to the specified value.
- Parameters
<a name="table119162123217"></a>
<table><thead align="left"><tr id="row4101628327"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p9109211320"><a name="p9109211320"></a><a name="p9109211320"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p31014220322"><a name="p31014220322"></a><a name="p31014220322"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p191142163214"><a name="p191142163214"></a><a name="p191142163214"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p31192163210"><a name="p31192163210"></a><a name="p31192163210"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row011526322"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p2011192143214"><a name="p2011192143214"></a><a name="p2011192143214"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p31211283214"><a name="p31211283214"></a><a name="p31211283214"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p6127243213"><a name="p6127243213"></a><a name="p6127243213"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p201222193217"><a name="p201222193217"></a><a name="p201222193217"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row21318293214"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p9134216327"><a name="p9134216327"></a><a name="p9134216327"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p131312218326"><a name="p131312218326"></a><a name="p131312218326"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p7131211326"><a name="p7131211326"></a><a name="p7131211326"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1013121325"><a name="p1013121325"></a><a name="p1013121325"></a>Value to match the <strong id="b675719315817"><a name="b675719315817"></a><a name="b675719315817"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table173321317173213"></a>
<table><thead align="left"><tr id="row6333141711327"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1033351710325"><a name="p1033351710325"></a><a name="p1033351710325"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p5333161763212"><a name="p5333161763212"></a><a name="p5333161763212"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row03333178323"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p183338171329"><a name="p183338171329"></a><a name="p183338171329"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p5333917133219"><a name="p5333917133219"></a><a name="p5333917133219"></a><strong id="b18178173072112"><a name="b18178173072112"></a><a name="b18178173072112"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.like("NAME", "%os%")
```
### glob<a name="section8668135612617"></a>
glob\(field: string, value: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the specified string.
- Parameters
<a name="table382114613515"></a>
<table><thead align="left"><tr id="row14821134612359"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p582214613356"><a name="p582214613356"></a><a name="p582214613356"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1582212467352"><a name="p1582212467352"></a><a name="p1582212467352"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p13822144683510"><a name="p13822144683510"></a><a name="p13822144683510"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p168224469351"><a name="p168224469351"></a><a name="p168224469351"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1282204613350"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p1782314464352"><a name="p1782314464352"></a><a name="p1782314464352"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p182319461356"><a name="p182319461356"></a><a name="p182319461356"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p11823134643511"><a name="p11823134643511"></a><a name="p11823134643511"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p12823846193519"><a name="p12823846193519"></a><a name="p12823846193519"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row178235463355"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p1082311466356"><a name="p1082311466356"></a><a name="p1082311466356"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p98241546123512"><a name="p98241546123512"></a><a name="p98241546123512"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p1682444643518"><a name="p1682444643518"></a><a name="p1682444643518"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p4824134683515"><a name="p4824134683515"></a><a name="p4824134683515"></a>Value to match the <strong id="b157597318583"><a name="b157597318583"></a><a name="b157597318583"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table17824346153511"></a>
<table><thead align="left"><tr id="row782554613353"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p182514610359"><a name="p182514610359"></a><a name="p182514610359"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1382519467358"><a name="p1382519467358"></a><a name="p1382519467358"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row2825104633512"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p982611460351"><a name="p982611460351"></a><a name="p982611460351"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p62241647143112"><a name="p62241647143112"></a><a name="p62241647143112"></a><strong id="b10180630172115"><a name="b10180630172115"></a><a name="b10180630172115"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.glob("NAME", "?h*g")
```
### between<a name="section18415928472"></a>
between\(field: string, low: ValueType, high: ValueType\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **ValueType** and value within the specified range.
- Parameters
<a name="table20583429113712"></a>
<table><thead align="left"><tr id="row85847296375"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p6584172933719"><a name="p6584172933719"></a><a name="p6584172933719"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1584529193716"><a name="p1584529193716"></a><a name="p1584529193716"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p15841029193720"><a name="p15841029193720"></a><a name="p15841029193720"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p858512299371"><a name="p858512299371"></a><a name="p858512299371"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row17585162983717"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p165857297377"><a name="p165857297377"></a><a name="p165857297377"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p15585329173718"><a name="p15585329173718"></a><a name="p15585329173718"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p6585102963711"><a name="p6585102963711"></a><a name="p6585102963711"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p11585122912376"><a name="p11585122912376"></a><a name="p11585122912376"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row1058692983714"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p1074493513718"><a name="p1074493513718"></a><a name="p1074493513718"></a>low</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p20845184112371"><a name="p20845184112371"></a><a name="p20845184112371"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p19586162911379"><a name="p19586162911379"></a><a name="p19586162911379"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p65868296372"><a name="p65868296372"></a><a name="p65868296372"></a>Minimum value to match the <strong id="b14438191462013"><a name="b14438191462013"></a><a name="b14438191462013"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
<tr id="row72261046133720"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p122754616371"><a name="p122754616371"></a><a name="p122754616371"></a>high</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p202275464372"><a name="p202275464372"></a><a name="p202275464372"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p12228194611372"><a name="p12228194611372"></a><a name="p12228194611372"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p2022844615374"><a name="p2022844615374"></a><a name="p2022844615374"></a>Maximum value to match the <strong id="b7785102615203"><a name="b7785102615203"></a><a name="b7785102615203"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table1990071724017"></a>
<table><thead align="left"><tr id="row1890051715402"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p11900617204016"><a name="p11900617204016"></a><a name="p11900617204016"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p14901131715400"><a name="p14901131715400"></a><a name="p14901131715400"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row169012017164010"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p15901201714019"><a name="p15901201714019"></a><a name="p15901201714019"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p19901517174018"><a name="p19901517174018"></a><a name="p19901517174018"></a><strong id="b101831730102112"><a name="b101831730102112"></a><a name="b101831730102112"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.between("AGE", 10, 50)
```
### notBetween<a name="section093519135818"></a>
notBetween\(field: string, low: ValueType, high: ValueType\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **ValueType** and value out of the specified range.
- Parameters
<a name="table197584411436"></a>
<table><thead align="left"><tr id="row17613449431"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p1376184414430"><a name="p1376184414430"></a><a name="p1376184414430"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p776184417436"><a name="p776184417436"></a><a name="p776184417436"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p13771744144316"><a name="p13771744144316"></a><a name="p13771744144316"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p877044174311"><a name="p877044174311"></a><a name="p877044174311"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row07717446438"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p1077544134317"><a name="p1077544134317"></a><a name="p1077544134317"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p157814417434"><a name="p157814417434"></a><a name="p157814417434"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p67854474311"><a name="p67854474311"></a><a name="p67854474311"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1981444134313"><a name="p1981444134313"></a><a name="p1981444134313"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row881844174312"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p1881154414435"><a name="p1881154414435"></a><a name="p1881154414435"></a>low</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p2811244194314"><a name="p2811244194314"></a><a name="p2811244194314"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p1981844104316"><a name="p1981844104316"></a><a name="p1981844104316"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1381844194316"><a name="p1381844194316"></a><a name="p1381844194316"></a>Minimum value to match the <strong id="b546722092013"><a name="b546722092013"></a><a name="b546722092013"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
<tr id="row1682184415434"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p178234418435"><a name="p178234418435"></a><a name="p178234418435"></a>high</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p118215442438"><a name="p118215442438"></a><a name="p118215442438"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p48274416436"><a name="p48274416436"></a><a name="p48274416436"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p88354494313"><a name="p88354494313"></a><a name="p88354494313"></a>Maximum value to match the <strong id="b798403114204"><a name="b798403114204"></a><a name="b798403114204"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table128484410435"></a>
<table><thead align="left"><tr id="row1984104418433"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p28534419438"><a name="p28534419438"></a><a name="p28534419438"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p178534434311"><a name="p178534434311"></a><a name="p178534434311"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row9859447436"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p4851244194314"><a name="p4851244194314"></a><a name="p4851244194314"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p1886194414437"><a name="p1886194414437"></a><a name="p1886194414437"></a><strong id="b71851830192116"><a name="b71851830192116"></a><a name="b71851830192116"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.notBetween("AGE", 10, 50)
```
### greaterThan<a name="section9224192116910"></a>
greaterThan\(field: string, value: ValueType\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **ValueType** and value greater than the specified value.
- Parameters
<a name="table15907134334611"></a>
<table><thead align="left"><tr id="row590934316468"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p390984354620"><a name="p390984354620"></a><a name="p390984354620"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1490918438469"><a name="p1490918438469"></a><a name="p1490918438469"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p59105436468"><a name="p59105436468"></a><a name="p59105436468"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1991064316465"><a name="p1991064316465"></a><a name="p1991064316465"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row199109433462"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p191114435467"><a name="p191114435467"></a><a name="p191114435467"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p39111043144610"><a name="p39111043144610"></a><a name="p39111043144610"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p391113433460"><a name="p391113433460"></a><a name="p391113433460"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1691124318464"><a name="p1691124318464"></a><a name="p1691124318464"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row199112433466"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p11911643134614"><a name="p11911643134614"></a><a name="p11911643134614"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1291284312465"><a name="p1291284312465"></a><a name="p1291284312465"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p7912943184616"><a name="p7912943184616"></a><a name="p7912943184616"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p29123434463"><a name="p29123434463"></a><a name="p29123434463"></a>Value to match the <strong id="b1176218325817"><a name="b1176218325817"></a><a name="b1176218325817"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table113949464474"></a>
<table><thead align="left"><tr id="row739524617479"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p43951446184714"><a name="p43951446184714"></a><a name="p43951446184714"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1539584614473"><a name="p1539584614473"></a><a name="p1539584614473"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row15395124684715"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p10396154614715"><a name="p10396154614715"></a><a name="p10396154614715"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p9396104604719"><a name="p9396104604719"></a><a name="p9396104604719"></a><strong id="b1018843072111"><a name="b1018843072111"></a><a name="b1018843072111"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.greaterThan("AGE", 18)
```
### lessThan<a name="section1731334619915"></a>
lessThan\(field: string, value: ValueType\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **ValueType** and value less than the specified value.
- Parameters
<a name="table2036015013499"></a>
<table><thead align="left"><tr id="row53612050184920"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p1436125013493"><a name="p1436125013493"></a><a name="p1436125013493"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p3362550174918"><a name="p3362550174918"></a><a name="p3362550174918"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p2036245015499"><a name="p2036245015499"></a><a name="p2036245015499"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1536265017492"><a name="p1536265017492"></a><a name="p1536265017492"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row12362950164910"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p4362115011494"><a name="p4362115011494"></a><a name="p4362115011494"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p13631250114915"><a name="p13631250114915"></a><a name="p13631250114915"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p17363145011499"><a name="p17363145011499"></a><a name="p17363145011499"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p113631950154917"><a name="p113631950154917"></a><a name="p113631950154917"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row1636311504494"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p11363150154917"><a name="p11363150154917"></a><a name="p11363150154917"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p9363145014910"><a name="p9363145014910"></a><a name="p9363145014910"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p7364150194915"><a name="p7364150194915"></a><a name="p7364150194915"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p17364195020494"><a name="p17364195020494"></a><a name="p17364195020494"></a>Value to match the <strong id="b7764113145810"><a name="b7764113145810"></a><a name="b7764113145810"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table736405034910"></a>
<table><thead align="left"><tr id="row193644507493"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p17365135014910"><a name="p17365135014910"></a><a name="p17365135014910"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p203657504496"><a name="p203657504496"></a><a name="p203657504496"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row193657502491"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p1636515074918"><a name="p1636515074918"></a><a name="p1636515074918"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p436516508490"><a name="p436516508490"></a><a name="p436516508490"></a><strong id="b319119303212"><a name="b319119303212"></a><a name="b319119303212"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.lessThan("AGE", 20)
```
### greaterThanOrEqualTo<a name="section19411192241013"></a>
greaterThanOrEqualTo\(field: string, value: ValueType\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **ValueType** and value greater than or equal to the specified value.
- Parameters
<a name="table1413816460511"></a>
<table><thead align="left"><tr id="row12139184613511"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p2139134612515"><a name="p2139134612515"></a><a name="p2139134612515"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p913974635120"><a name="p913974635120"></a><a name="p913974635120"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p16140746115115"><a name="p16140746115115"></a><a name="p16140746115115"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p13140144675114"><a name="p13140144675114"></a><a name="p13140144675114"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row13140124635115"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p171407461519"><a name="p171407461519"></a><a name="p171407461519"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1414116467518"><a name="p1414116467518"></a><a name="p1414116467518"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p19141174675113"><a name="p19141174675113"></a><a name="p19141174675113"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p514164619518"><a name="p514164619518"></a><a name="p514164619518"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row17141134635114"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p11141124619518"><a name="p11141124619518"></a><a name="p11141124619518"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1114234612517"><a name="p1114234612517"></a><a name="p1114234612517"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p16142646175117"><a name="p16142646175117"></a><a name="p16142646175117"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p3142164615120"><a name="p3142164615120"></a><a name="p3142164615120"></a>Value to match the <strong id="b1576733145813"><a name="b1576733145813"></a><a name="b1576733145813"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table176851057155119"></a>
<table><thead align="left"><tr id="row168635755117"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p8686657125118"><a name="p8686657125118"></a><a name="p8686657125118"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p12686195717515"><a name="p12686195717515"></a><a name="p12686195717515"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1686457135114"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p668710576514"><a name="p668710576514"></a><a name="p668710576514"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p116871157135117"><a name="p116871157135117"></a><a name="p116871157135117"></a><strong id="b151939301216"><a name="b151939301216"></a><a name="b151939301216"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.greaterThanOrEqualTo("AGE", 18)
```
### lessThanOrEqualTo<a name="section855697131115"></a>
lessThanOrEqualTo\(field: string, value: ValueType\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **ValueType** and value less than or equal to the specified value.
- Parameters
<a name="table1333124219536"></a>
<table><thead align="left"><tr id="row13311942175315"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p633244255310"><a name="p633244255310"></a><a name="p633244255310"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p833264245313"><a name="p833264245313"></a><a name="p833264245313"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p333210425537"><a name="p333210425537"></a><a name="p333210425537"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p2332204210539"><a name="p2332204210539"></a><a name="p2332204210539"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row033311425538"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p16333842165315"><a name="p16333842165315"></a><a name="p16333842165315"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p5333104216536"><a name="p5333104216536"></a><a name="p5333104216536"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p4333154218535"><a name="p4333154218535"></a><a name="p4333154218535"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p17334204215534"><a name="p17334204215534"></a><a name="p17334204215534"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row1033434212538"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p183346424538"><a name="p183346424538"></a><a name="p183346424538"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p833594265316"><a name="p833594265316"></a><a name="p833594265316"></a><a href="js-apis-data-rdb.md#section56419143718">ValueType</a></p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p113351342135317"><a name="p113351342135317"></a><a name="p113351342135317"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p16335242135314"><a name="p16335242135314"></a><a name="p16335242135314"></a>Value to match the <strong id="b577016319585"><a name="b577016319585"></a><a name="b577016319585"></a>DataAbilityPredicates</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table1733634213537"></a>
<table><thead align="left"><tr id="row6336114275316"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1433613421533"><a name="p1433613421533"></a><a name="p1433613421533"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p433634212530"><a name="p433634212530"></a><a name="p433634212530"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row10336154295319"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p18337164225318"><a name="p18337164225318"></a><a name="p18337164225318"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p173371242165319"><a name="p173371242165319"></a><a name="p173371242165319"></a><strong id="b819612309215"><a name="b819612309215"></a><a name="b819612309215"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.lessThanOrEqualTo("AGE", 20)
```
### orderByAsc<a name="section10613839161111"></a>
orderByAsc\(field: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the column with values sorted in ascending order.
- Parameters
<a name="table1988111105513"></a>
<table><thead align="left"><tr id="row688214112556"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p1088211113557"><a name="p1088211113557"></a><a name="p1088211113557"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1988217117551"><a name="p1988217117551"></a><a name="p1988217117551"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p888381115513"><a name="p888381115513"></a><a name="p888381115513"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p588381195519"><a name="p588381195519"></a><a name="p588381195519"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row98831711155517"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p13883101125515"><a name="p13883101125515"></a><a name="p13883101125515"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p148845117556"><a name="p148845117556"></a><a name="p148845117556"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p588441185517"><a name="p588441185517"></a><a name="p588441185517"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p68841111195510"><a name="p68841111195510"></a><a name="p68841111195510"></a>Column name in the database table.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table19793932175619"></a>
<table><thead align="left"><tr id="row379573215620"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1279593216561"><a name="p1279593216561"></a><a name="p1279593216561"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1979553212564"><a name="p1979553212564"></a><a name="p1979553212564"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row14795123211566"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p17796532125612"><a name="p17796532125612"></a><a name="p17796532125612"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p77969322566"><a name="p77969322566"></a><a name="p77969322566"></a><strong id="b31981730162116"><a name="b31981730162116"></a><a name="b31981730162116"></a>DataAbilityPredicates</strong> object that matches the column sorted in the specified order.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.orderByAsc("NAME")
```
### orderByDesc<a name="section1277751220124"></a>
orderByDesc\(field: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the column with values sorted in descending order.
- Parameters
<a name="table1187173145817"></a>
<table><thead align="left"><tr id="row0871113125818"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p13871123115816"><a name="p13871123115816"></a><a name="p13871123115816"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p38722039586"><a name="p38722039586"></a><a name="p38722039586"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p2872833583"><a name="p2872833583"></a><a name="p2872833583"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1787212325819"><a name="p1787212325819"></a><a name="p1787212325819"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row28723320585"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p48728365820"><a name="p48728365820"></a><a name="p48728365820"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1687283105820"><a name="p1687283105820"></a><a name="p1687283105820"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p28735316584"><a name="p28735316584"></a><a name="p28735316584"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1387316305811"><a name="p1387316305811"></a><a name="p1387316305811"></a>Column name in the database table.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table9873183105812"></a>
<table><thead align="left"><tr id="row687310316581"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p3874173145810"><a name="p3874173145810"></a><a name="p3874173145810"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1874103145814"><a name="p1874103145814"></a><a name="p1874103145814"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1287418335817"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p28749355816"><a name="p28749355816"></a><a name="p28749355816"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p1987416318588"><a name="p1987416318588"></a><a name="p1987416318588"></a><strong id="b820273016219"><a name="b820273016219"></a><a name="b820273016219"></a>DataAbilityPredicates</strong> object that matches the column sorted in the specified order.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.orderByDesc("AGE")
```
### distinct<a name="section1525512399124"></a>
distinct\(\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to filter out duplicate records.
- Return values
<a name="table929218331804"></a>
<table><thead align="left"><tr id="row1529311337018"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p2293113314012"><a name="p2293113314012"></a><a name="p2293113314012"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p92947336018"><a name="p92947336018"></a><a name="p92947336018"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1229414331705"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p329415336012"><a name="p329415336012"></a><a name="p329415336012"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p2029411332017"><a name="p2029411332017"></a><a name="p2029411332017"></a><strong id="b1430243813468"><a name="b1430243813468"></a><a name="b1430243813468"></a>DataAbilityPredicates</strong> object that can filter out duplicate records.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").distinct("NAME")
rdbStore.query(predicates, ["NAME"])
```
### limitAs<a name="section183021921138"></a>
limitAs\(value: number\): DataAbilityPredicates
Set the **DataAbilityPredicates** that specify the maximum number of records.
- Parameters
<a name="table1817013541934"></a>
<table><thead align="left"><tr id="row121711354135"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p141711548316"><a name="p141711548316"></a><a name="p141711548316"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p117165412316"><a name="p117165412316"></a><a name="p117165412316"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p117215411316"><a name="p117215411316"></a><a name="p117215411316"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p6172105410311"><a name="p6172105410311"></a><a name="p6172105410311"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row61739541532"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p12173254738"><a name="p12173254738"></a><a name="p12173254738"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p51734544311"><a name="p51734544311"></a><a name="p51734544311"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p18174354137"><a name="p18174354137"></a><a name="p18174354137"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1517417541634"><a name="p1517417541634"></a><a name="p1517417541634"></a>Maximum number of records in a column.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table3565171111519"></a>
<table><thead align="left"><tr id="row195651611953"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p8566181114518"><a name="p8566181114518"></a><a name="p8566181114518"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1856613111857"><a name="p1856613111857"></a><a name="p1856613111857"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row656641112518"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p14566121116510"><a name="p14566121116510"></a><a name="p14566121116510"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p1556711111755"><a name="p1556711111755"></a><a name="p1556711111755"></a><strong id="b167661054195110"><a name="b167661054195110"></a><a name="b167661054195110"></a>DataAbilityPredicates</strong> that can be used to set the maximum number of records.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").limitAs(3)
```
### offsetAs<a name="section140411296135"></a>
offsetAs\(rowOffset: number\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to specify the start position of the returned result.
- Parameters
<a name="table174331881171"></a>
<table><thead align="left"><tr id="row164341282071"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p174341481670"><a name="p174341481670"></a><a name="p174341481670"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p84341686719"><a name="p84341686719"></a><a name="p84341686719"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p043538874"><a name="p043538874"></a><a name="p043538874"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1243568873"><a name="p1243568873"></a><a name="p1243568873"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row54351786714"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p11735614472"><a name="p11735614472"></a><a name="p11735614472"></a>rowOffset</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1943520815712"><a name="p1943520815712"></a><a name="p1943520815712"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p8436385715"><a name="p8436385715"></a><a name="p8436385715"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p643616810715"><a name="p643616810715"></a><a name="p643616810715"></a>Number of rows to offset from the beginning. The value is a positive integer.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table22586341383"></a>
<table><thead align="left"><tr id="row9258183415812"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1125819341181"><a name="p1125819341181"></a><a name="p1125819341181"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1425912344814"><a name="p1425912344814"></a><a name="p1425912344814"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row52591234987"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p9259934787"><a name="p9259934787"></a><a name="p9259934787"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p1259123415819"><a name="p1259123415819"></a><a name="p1259123415819"></a><strong id="b73181951193716"><a name="b73181951193716"></a><a name="b73181951193716"></a>DataAbilityPredicates</strong> object that specifies the start position of the returned result.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").offsetAs(3)
```
### groupBy<a name="section1512514535133"></a>
groupBy\(fields: Array<string\>\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to group rows that have the same value into summary rows.
- Parameters
<a name="table1633191451119"></a>
<table><thead align="left"><tr id="row19634171417117"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p863417141117"><a name="p863417141117"></a><a name="p863417141117"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1063519146117"><a name="p1063519146117"></a><a name="p1063519146117"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p18635414161119"><a name="p18635414161119"></a><a name="p18635414161119"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1963581417116"><a name="p1963581417116"></a><a name="p1963581417116"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row563521441118"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p11593122141115"><a name="p11593122141115"></a><a name="p11593122141115"></a>fields</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1663613144111"><a name="p1663613144111"></a><a name="p1663613144111"></a>Array&lt;string&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p17636101411112"><a name="p17636101411112"></a><a name="p17636101411112"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p13636614201116"><a name="p13636614201116"></a><a name="p13636614201116"></a>Names of columns grouped for querying data.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table1712684521212"></a>
<table><thead align="left"><tr id="row112615451128"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1912613454129"><a name="p1912613454129"></a><a name="p1912613454129"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1112694513128"><a name="p1112694513128"></a><a name="p1112694513128"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row15126164510125"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p6127745111213"><a name="p6127745111213"></a><a name="p6127745111213"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p158461234133315"><a name="p158461234133315"></a><a name="p158461234133315"></a><strong id="b114291481777"><a name="b114291481777"></a><a name="b114291481777"></a>DataAbilityPredicates</strong> object that groups rows that have the same value.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.groupBy(["AGE", "NAME"])
```
### indexedBy<a name="section6724191991418"></a>
indexedBy\(indexName: string\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to specify the index column.
- Parameters
<a name="table554414420111"></a>
<table><thead align="left"><tr id="row16546194412114"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p1654611443116"><a name="p1654611443116"></a><a name="p1654611443116"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p16546344113"><a name="p16546344113"></a><a name="p16546344113"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p1054734416118"><a name="p1054734416118"></a><a name="p1054734416118"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p145471447111"><a name="p145471447111"></a><a name="p145471447111"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row3547134413117"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p13494109104218"><a name="p13494109104218"></a><a name="p13494109104218"></a>indexName</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p195492441015"><a name="p195492441015"></a><a name="p195492441015"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p205491044013"><a name="p205491044013"></a><a name="p205491044013"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p654944414119"><a name="p654944414119"></a><a name="p654944414119"></a>Name of the index column.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table393195010519"></a>
<table><thead align="left"><tr id="row15945501454"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p194145017515"><a name="p194145017515"></a><a name="p194145017515"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p19941650258"><a name="p19941650258"></a><a name="p19941650258"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row495145015516"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p89575013516"><a name="p89575013516"></a><a name="p89575013516"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p295115013511"><a name="p295115013511"></a><a name="p295115013511"></a><strong id="b628505616429"><a name="b628505616429"></a><a name="b628505616429"></a>DataAbilityRdbPredicates</strong> object that specifies the index column.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.indexedBy("SALARY_INDEX")
```
### in<a name="section8947145381415"></a>
in\(field: string, value: Array<ValueType\>\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **Array<ValueType\>** and value within the specified range.
- Parameters
<a name="table8311622131917"></a>
<table><thead align="left"><tr id="row8312172231914"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p19312142217196"><a name="p19312142217196"></a><a name="p19312142217196"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p331272217196"><a name="p331272217196"></a><a name="p331272217196"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p331332216195"><a name="p331332216195"></a><a name="p331332216195"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1631312281918"><a name="p1631312281918"></a><a name="p1631312281918"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row103139226191"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p131415229191"><a name="p131415229191"></a><a name="p131415229191"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p18314922111916"><a name="p18314922111916"></a><a name="p18314922111916"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p7314112231916"><a name="p7314112231916"></a><a name="p7314112231916"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p163145220191"><a name="p163145220191"></a><a name="p163145220191"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row8822182915196"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p3823152961916"><a name="p3823152961916"></a><a name="p3823152961916"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p582352914191"><a name="p582352914191"></a><a name="p582352914191"></a>Array&lt;<a href="js-apis-data-rdb.md#section56419143718">ValueType</a>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p148231429171910"><a name="p148231429171910"></a><a name="p148231429171910"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p17824202914199"><a name="p17824202914199"></a><a name="p17824202914199"></a>Array of <strong id="b783554924010"><a name="b783554924010"></a><a name="b783554924010"></a>ValueType</strong> to match.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table827316323259"></a>
<table><thead align="left"><tr id="row32741232102511"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p12741932152515"><a name="p12741932152515"></a><a name="p12741932152515"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p192741832102515"><a name="p192741832102515"></a><a name="p192741832102515"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row14274133222511"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p3275183252515"><a name="p3275183252515"></a><a name="p3275183252515"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p827513325255"><a name="p827513325255"></a><a name="p827513325255"></a><strong id="b1020511304213"><a name="b1020511304213"></a><a name="b1020511304213"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.in("AGE", [18, 20])
```
### notIn<a name="section1294132119155"></a>
notIn\(field: string, value: Array<ValueType\>\): DataAbilityPredicates
Sets the **DataAbilityPredicates** to match the field with data type **Array<ValueType\>** and value out of the specified range.
- Parameters
<a name="table3136194115358"></a>
<table><thead align="left"><tr id="row1713754118358"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p121371041113511"><a name="p121371041113511"></a><a name="p121371041113511"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p13138154115359"><a name="p13138154115359"></a><a name="p13138154115359"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p111381941143514"><a name="p111381941143514"></a><a name="p111381941143514"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p7138164123513"><a name="p7138164123513"></a><a name="p7138164123513"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row6139144120354"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p4139124120352"><a name="p4139124120352"></a><a name="p4139124120352"></a>field</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p51391241113515"><a name="p51391241113515"></a><a name="p51391241113515"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p11140104110358"><a name="p11140104110358"></a><a name="p11140104110358"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p4140741183519"><a name="p4140741183519"></a><a name="p4140741183519"></a>Column name in the database table.</p>
</td>
</tr>
<tr id="row1514016418353"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p1114154113353"><a name="p1114154113353"></a><a name="p1114154113353"></a>value</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1714174118355"><a name="p1714174118355"></a><a name="p1714174118355"></a>Array&lt;<a href="js-apis-data-rdb.md#section56419143718">ValueType</a>&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p141421441133516"><a name="p141421441133516"></a><a name="p141421441133516"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p414294116359"><a name="p414294116359"></a><a name="p414294116359"></a>Array of <strong id="b17310457426"><a name="b17310457426"></a><a name="b17310457426"></a>ValueType</strong> to match.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table5143541133514"></a>
<table><thead align="left"><tr id="row1314484143514"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p131441141153511"><a name="p131441141153511"></a><a name="p131441141153511"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p1714544115358"><a name="p1714544115358"></a><a name="p1714544115358"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1814544133514"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p1814511417359"><a name="p1814511417359"></a><a name="p1814511417359"></a><a href="#section55051094515">DataAbilityPredicates</a></p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p614594118351"><a name="p614594118351"></a><a name="p614594118351"></a><strong id="b2020753020213"><a name="b2020753020213"></a><a name="b2020753020213"></a>DataAbilityPredicates</strong> object that matches the specified field.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.notIn("NAME", ["Lisa", "Rose"])
```
### 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](js-apis-data-rdb.md#valuetype) | Yes| Value to match the **DataAbilityPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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](js-apis-data-rdb.md#valuetype) | Yes| Value to match the **DataAbilityPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbilitylity.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "lisi")
.beginWrap()
.equalTo("AGE", 18)
.or()
.equalTo("SALARY", 200.5)
.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "lisi")
.beginWrap()
.equalTo("AGE", 18)
.or()
.equalTo("SALARY", 200.5)
.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.glob("NAME", "?h*g")
```
### between
between(field: string, low: ValueType, high: ValueType): DataAbilityPredicates
Sets a **DataAbilityPredicates** object to match the field with data type **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.|
| low | [ValueType](js-apis-data-rdb.md#valuetype) | Yes| Minimum value to match the **DataAbilityPredicates**.|
| high | [ValueType](js-apis-data-rdb.md#valuetype) | Yes| Maximum value to match the **DataAbilityPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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.|
| low | [ValueType](js-apis-data-rdb.md#valuetype) | Yes| Minimum value to match the **DataAbilityPredicates**.|
| high | [ValueType](js-apis-data-rdb.md#valuetype) | Yes| Maximum value to match the **DataAbilityPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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](js-apis-data-rdb.md#valuetype) | Yes| Value to match the **DataAbilityPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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](js-apis-data-rdb.md#valuetype) | Yes| Value to match the **DataAbilityPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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](js-apis-data-rdb.md#valuetype) | Yes| Value to match the **DataAbilityPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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](js-apis-data-rdb.md#valuetype) | Yes| Value to match the **DataAbilityPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").distinct("NAME")
let promiseDistinct = rdbStore.query(predicates, ["NAME"])
promiseDistinct.then((resultSet) => {
console.log("distinct")
}).catch((err) => {
expect(null).assertFail();
})
```
### 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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").offsetAs(3)
```
### groupBy
groupBy(fields: Array&lt;string&gt;): 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&lt;string&gt; | Yes| Names of columns to group.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that groups rows with the same value.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.groupBy(["AGE", "NAME"])
```
### indexedBy
indexedBy(field: string): DataAbilityPredicates
Sets a **DataAbilityPredicates** object to specify the index column.
- 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:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.indexedBy("SALARY_INDEX")
```
### in
in(field: string, value: Array&lt;ValueType&gt;): 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.|
| value | Array&lt;[ValueType](js-apis-data-rdb.md#valuetype)&gt; | Yes| Array of **ValueType**s to match.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.in("AGE", [18, 20])
```
### notIn
notIn(field: string, value: Array&lt;ValueType&gt;): 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&lt;[ValueType](js-apis-data-rdb.md#valuetype)&gt; | Yes| Array of **ValueType**s to match.|
- Return value
| Type| Description|
| -------- | -------- |
| [DataAbilityPredicates](#dataabilitypredicates) | **DataAbilityPredicates** object that matches the specified field.|
- Example:
```
let predicates = new dataAbility.DataAbilityPredicates("EMPLOYEE")
predicates.notIn("NAME", ["Lisa", "Rose"])
```
# Distributed Object
# Distributed Data Object
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -17,16 +17,21 @@ import distributedObject from '@ohos.data.distributedDataObject'
createDistributedObject(source: object): DistributedObject
Creates a **distributedObject** instance. You can specify the attribute of the instance in **source**. This method returns the **distributedObject** instance created.
Creates a distributed data object.
** System Capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
- **Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| object | source | Yes| Attribute of the **distributedObject** instance to create.|
| source | object | Yes| Attribute of the distributed data object to create.|
- Example
**Return Value**
| Type| Description|
| -------- | -------- |
| [DistributedObject](#distributedobject) | Distributed data object created.|
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject'
// Create a distributedObject instance. The attribute type of the object can be string, number, boolean, or Object.
......@@ -39,16 +44,16 @@ Creates a **distributedObject** instance. You can specify the attribute of the i
genSessionId(): string
Creates a session ID randomly.
Creates a random session ID.
** System Capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
- Return value
**Return Value**
| Type| Description|
| -------- | -------- |
| string | Session ID created.|
- Example
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject'
var sessionId = distributedObject.genSessionId();
......@@ -58,20 +63,29 @@ Creates a session ID randomly.
## DistributedObject
Represents a **distributedObject** instance.
### setSessionId
setSessionId(sessionId?: string): boolean
Sets a session ID for synchronization. Automatic synchronization is performed for multiple devices with the same session ID on a trusted network. To remove a device from the distributed network, set this parameter to "" or leave it unspecified. If **true** is returned, the session ID is set successfully.
Sets a session ID for synchronization. Automatic synchronization is performed for multiple devices with the same session ID on a trusted network.
** System Capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Parameters**
- **Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| sessionId | string | No| ID of a distributed object on a trusted network.|
| sessionId | string | No| ID of a distributed data object on a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.|
**Return Value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the session ID is set successfully;<br>returns **false** otherwise. |
- Example
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject'
var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,
......@@ -87,17 +101,17 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo
on(type: 'change', callback: Callback<{ sessionId: string, fields: Array&lt;string&gt; }>): void
Subscribes to the data changes of this distributed object.
Subscribes to the data changes of this distributed data object.
** System Capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
- **Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data change events.|
| callback | Callback<{ sessionId: string, fields: Array&lt;string&gt; }> | Yes| Callback used to return the data changes of the distributed object. In the callback, **sessionId** indicates the session ID of the distributed object, and **fields** indicates the attributes of the object.|
| callback | Callback<{ sessionId: string, fields: Array&lt;string&gt; }> | Yes| Callback used to return the changes of the distributed data object.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the attributes of the distributed data object changed.|
- Example
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject'
var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,
......@@ -116,18 +130,18 @@ Subscribes to the data changes of this distributed object.
off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array&lt;string&gt; }>): void
Unsubscribes from the data changes of this distributed object.
Unsubscribes from the data changes of this distributed data object.
** System Capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
- **Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data change events.|
| callback | Callback<{ sessionId: string, fields: Array&lt;string&gt; }> | No| Callback used to return changes of the distributed object. If this parameter is not specified, all callbacks related to data changes will be unregistered.|
| type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data change events.|
| callback | Callback<{ sessionId: string, fields: Array&lt;string&gt; }> | No| Callback used to return changes of the distributed data object. If this parameter is not specified, all callbacks related to data changes will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**fields** indicates the attributes of the distributed data object changed.|
- Example
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject'
var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,
......@@ -135,7 +149,7 @@ Unsubscribes from the data changes of this distributed object.
g_object.on("change", function (sessionId, changeData) {
console.info("change" + sessionId);
});
// Unsubscribe from the data change callback for the specified distributed object.
// Unsubscribe from the data change callback for the specified distributed data object.
g_object.off("change", function (sessionId, changeData) {
console.info("change" + sessionId);
});
......@@ -147,17 +161,19 @@ Unsubscribes from the data changes of this distributed object.
on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void
Subscribes to the status changes (online or offline) of this distributed object.
Subscribes to the status changes (online or offline) of this distributed data object.
** System Capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
- **Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to subscribe to. The value is "status", which indicates the status (online or offline) change events.|
| callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | Yes| Callback used to return the status changes of the distributed object. In the callback, **sessionId** indicates the session ID of the distributed object, and **status** indicates the online or offline status of the distributed object.|
| callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | Yes| Callback used to return the online or offline status.<br>**sessionId** indicates the session ID of the distributed data object.<br>**networkId** indicates the network ID of the device.<br>**status** indicates the status, which can be online or offline.|
- Example
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject'
var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,
......@@ -172,24 +188,24 @@ Subscribes to the status changes (online or offline) of this distributed object.
off(type: 'status', callback?: Callback<{ sessionId: string, deviceId: string, status: 'online' | 'offline' }>): void
Unsubscribes from the status (online or offline) changes of the distributed object.
Unsubscribes from the status (online or offline) changes of the distributed data object.
** System Capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
- **Parameters**
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type to subscribe to. The value is "status", which indicates the status (online or offline) change events.|
| callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | No| Callback used to return the status changes. If this parameter is not specified, all the status change callbacks will be unregistered.|
| callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback used to return the status changes. If this parameter is not specified, all the status change callbacks will be unregistered.<br>**sessionId** indicates the session ID of the distributed data object.<br>**deviceId** indicates the device ID of the distributed data object.<br>**status** indicates the status, which can be online or offline.|
- Example
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject'
g_object.on("status", function (sessionId, networkId, status) {
this.response += "status changed " + sessionId + " " + status + " " + networkId;
});
// Unsubscribe from the status change callback for the specified distributed object.
// Unsubscribe from the status change callback for the specified distributed data object.
g_object.off("status", function (sessionId, networkId, status) {
this.response += "status changed " + sessionId + " " + status + " " + networkId;
});
......
# Relational Database
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
>
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
......@@ -12,71 +11,112 @@
import data_rdb from '@ohos.data.rdb'
```
## System Capabilities
SystemCapability.DistributedDataManager.RelationalStore.Core
## data_rdb.getRdbStore
getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback&lt;RdbStore&gt;): void
Obtains a relational database (RDB) store. You can set parameters for the RDB store based on service requirements, call APIs to perform data operations, and use a callback to return the result.
Obtains a relational database (RDB) store. This method uses an asynchronous callback to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | Context | Yes| Context of the app or functionality.|
| config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.|
| version | number | Yes| RDB store version.|
| callback | AsyncCallback&lt;[RdbStore](#rdbstore)&gt; | Yes| Callback invoked to return the RDB store obtained.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
```
import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability {
const STORE_CONFIG = { name: "RdbTest.db"}
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
data_rdb.getRdbStore(this.context, STORE_CONFIG, 1, function (err, rdbStore) {
rdbStore.executeSql(SQL_CREATE_TABLE)
console.info(TAG + 'create table done.')
})
}
```
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context<sup>8+</sup> | Context | Yes| Context of the app or functionality.|
| config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.|
| version | number | Yes| RDB store version.|
| callback | AsyncCallback&lt;[RdbStore](#rdbstore)&gt; | Yes| Callback invoked to return the RDB store obtained.|
**Example**
```
import data_rdb from '@ohos.data.rdb'
const STORE_CONFIG = { name: "RdbTest.db"}
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
data_rdb.getRdbStore(STORE_CONFIG, 1, function (err, rdbStore) {
rdbStore.executeSql(SQL_CREATE_TABLE)
console.info('create table done.')
})
```
The sample code of API<sup>9</sup> is as follows:
```
import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability {
const STORE_CONFIG = { name: "RdbTest.db"}
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
data_rdb.getRdbStore(this.context, STORE_CONFIG, 1, function (err, rdbStore) {
rdbStore.executeSql(SQL_CREATE_TABLE)
console.info('create table done.')
})
}
```
## data_rdb.getRdbStore
getRdbStore(context: Context, config: StoreConfig, version: number): Promise&lt;RdbStore&gt;
Obtains an RDB store. You can set parameters for the RDB store based on service requirements, call APIs to perform data operations, and use a promise to return the result.
Obtains an RDB store. This method uses a promise to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | Context | Yes| Context of the app or functionality.|
| config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.|
| version | number | Yes| RDB store version.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;[RdbStore](#rdbstore)&gt; | Promise used to return the RDB store obtained.|
**Parameters**
- Example
```
import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability {
const STORE_CONFIG = { name: "RdbTest.db" }
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
let promise = data_rdb.getRdbStore(this.context, STORE_CONFIG, 1);
promise.then(async (rdbStore) => {
await rdbStore.executeSql(SQL_CREATE_TABLE, null)
}).catch((err) => {
expect(null).assertFail();
})
}
```
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context<sup>8+</sup> | Context | Yes| Context of the app or functionality.|
| config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.|
| version | number | Yes| RDB store version.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[RdbStore](#rdbstore)&gt; | Promise used to return the RDB store obtained.|
**Example**
```
import data_rdb from '@ohos.data.rdb'
const STORE_CONFIG = { name: "RdbTest.db" }
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
let promisegetRdb = data_rdb.getRdbStore(STORE_CONFIG, 1);
promisegetRdb.then(async (rdbStore) => {
let promiseExecSql = rdbStore.executeSql(SQL_CREATE_TABLE, null)
promiseExecSql.then(() => {
console.info('executeSql creat done.')
}).catch((err) => {
console.log("executeSql creat err.")
})
}).catch((err) => {
console.log("getRdbStore err.")
})
```
The sample code of API<sup>9</sup> is as follows:
```
import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability {
const STORE_CONFIG = { name: "RdbTest.db" }
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
let promisegetRdb = data_rdb.getRdbStore(this.context, STORE_CONFIG, 1);
promisegetRdb.then(async (rdbStore) => {
let promiseExecSql = rdbStore.executeSql(SQL_CREATE_TABLE, null)
promiseExecSql.then(() => {
console.info('executeSql creat done.')
}).catch((err) => {
console.log("executeSql creat err.")
})
}).catch((err) => {
console.log("getRdbStore err.")
})
}
```
## data_rdb.deleteRdbStore
......@@ -84,52 +124,80 @@ deleteRdbStore(context: Context, name: string, callback: AsyncCallback&lt;void&g
Deletes an RDB store. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | Context | Yes| Context of the app or functionality.|
| name | string | Yes| Name of the RDB store to delete.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result. If the RDB store is deleted, **true** will be returned. Otherwise, **false** will be returned.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context<sup>8+</sup> | Context | Yes| Context of the app or functionality.|
| name | string | Yes| Name of the RDB store to delete.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result.|
**Example**
```
import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability {
data_rdb.deleteRdbStore(this.context, "RdbTest.db", function (err, rdbStore) {
console.info(TAG + 'delete store done.')})
}
data_rdb.deleteRdbStore("RdbTest.db", function (err, rdbStore) {
console.info('delete store done.')
})
```
The sample code of API<sup>9</sup> is as follows:
```
import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability {
data_rdb.deleteRdbStore(this.context, "RdbTest.db", function (err, rdbStore) {
console.info('delete store done.')
})
}
```
## data_rdb.deleteRdbStore
deleteRdbStore(context: Context, name: string): Promise&lt;void&gt;
Deletes an RDB store. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | Context | Yes| Context of the app or functionality.|
| name | string | Yes| Name of the RDB store to delete.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result. If the RDB store is deleted, **true** will be returned. Otherwise, **false** will be returned.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context<sup>8+</sup> | Context | Yes| Context of the app or functionality.|
| name | string | Yes| Name of the RDB store to delete.|
- Example
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```
import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability {
let promise = data_rdb.deleteRdbStore(this.context, "RdbTest.db")
promise.then(()=>{
console.info(TAG + 'delete store done.')
})
}
let promisedeleteRdb = data_rdb.deleteRdbStore("RdbTest.db")
promisedeleteRdb.then(()=>{
console.info('delete store done.')
}).catch((err) => {
console.log("deleteRdbStore err.")
})
```
The sample code of API<sup>9</sup> is as follows:
```
import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability {
let promisedeleteRdb = data_rdb.deleteRdbStore(this.context, "RdbTest.db")
promisedeleteRdb.then(()=>{
console.info('delete store done.')
}).catch((err) => {
console.log("deleteRdbStore err.")
})
}
```
## RdbPredicates
Defines predicates for an RDB store. This class determines whether the conditional expression for the RDB store is true or false.
......@@ -142,55 +210,58 @@ constructor(name: string)
A constructor used to create an **RdbPredicates** object.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Database table name.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Database table name.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
```
### inDevices
### inDevices<sup>8+</sup>
inDevices(devices: Array<string>): RdbPredicates;
inDevices(devices: Array&lt;string&gt;): RdbPredicates
Specifies a remote device on the network during distributed database synchronization.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| devices | Array<string> | Yes| ID of the remote device to specify.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| devices | Array&lt;string&gt; | Yes| ID of the remote device to specify.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicate.inDevices(['12345678abcde'])
```
### inAllDevices
### inAllDevices<sup>8+</sup>
inAllDevices(): RdbPredicates;
inAllDevices(): RdbPredicates
Connects to all remote devices on the network during distributed database synchronization.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.inAllDevices()
......@@ -203,19 +274,20 @@ equalTo(field: string, value: ValueType): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **ValueType** and value equal to the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "lisi")
......@@ -229,19 +301,20 @@ notEqualTo(field: string, value: ValueType): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **ValueType** and value not equal to the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.notEqualTo("NAME", "lisi")
......@@ -255,13 +328,14 @@ beginWrap(): RdbPredicates
Adds a left parenthesis to the **RdbPredicates**.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** with a left parenthesis.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** with a left parenthesis.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "lisi")
......@@ -280,13 +354,14 @@ endWrap(): RdbPredicates
Adds a right parenthesis to the **RdbPredicates**.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** with a right parenthesis.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** with a right parenthesis.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "lisi")
......@@ -305,13 +380,14 @@ or(): RdbPredicates
Adds the OR condition to the **RdbPredicates**.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** with the OR condition.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** with the OR condition.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Lisa")
......@@ -327,13 +403,14 @@ and(): RdbPredicates
Adds the AND condition to the **RdbPredicates**.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** with the AND condition.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** with the AND condition.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Lisa")
......@@ -344,24 +421,24 @@ Adds the AND condition to the **RdbPredicates**.
### contains
contains(field: string, value: string): RdbPredicat
contains(field: string, value: string): RdbPredicates
Sets the **RdbPredicates** to match a string containing the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.contains("NAME", "os")
......@@ -375,19 +452,20 @@ beginsWith(field: string, value: string): RdbPredicates
Sets the **RdbPredicates** to match a string that starts with the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.beginsWith("NAME", "os")
......@@ -401,19 +479,20 @@ endsWith(field: string, value: string): RdbPredicates
Sets the **RdbPredicates** to match a string that ends with the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.endsWith("NAME", "se")
......@@ -427,16 +506,17 @@ isNull(field: string): RdbPredicates
Sets the **RdbPredicates** to match the field whose value is null.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
```
......@@ -452,18 +532,19 @@ isNotNull(field: string): RdbPredicates
Sets the **RdbPredicates** to match the field whose value is not null.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.isNotNull("NAME")
......@@ -477,19 +558,20 @@ like(field: string, value: string): RdbPredicates
Sets the **RdbPredicates** to match a string that is similar to the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.like("NAME", "%os%")
......@@ -503,19 +585,20 @@ glob(field: string, value: string): RdbPredicates
Sets the **RdbPredicates** to match the specified string.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**. <br>Wildcards are supported. ***** indicates zero, one, or multiple digits or characters. **?** indicates a single digit or character.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | string | Yes| Value to match the **RdbPredicates**.<br><br>Wildcards are supported. ***** indicates zero, one, or multiple digits or characters. **?** indicates a single digit or character.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.glob("NAME", "?h*g")
......@@ -529,20 +612,21 @@ between(field: string, low: ValueType, high: ValueType): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **ValueType** and value within the specified range.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| low | [ValueType](#valuetype) | Yes| Minimum value to match the **RdbPredicates**.|
| high | [ValueType](#valuetype) | Yes| Maximum value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| low | [ValueType](#valuetype) | Yes| Minimum value to match the **RdbPredicates**.|
| high | [ValueType](#valuetype) | Yes| Maximum value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.between("AGE", 10, 50)
......@@ -556,20 +640,21 @@ notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **ValueType** and value out of the specified range.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| low | [ValueType](#valuetype) | Yes| Minimum value to match the **RdbPredicates**.|
| high | [ValueType](#valuetype) | Yes| Maximum value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| low | [ValueType](#valuetype) | Yes| Minimum value to match the **RdbPredicates**.|
| high | [ValueType](#valuetype) | Yes| Maximum value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.notBetween("AGE", 10, 50)
......@@ -578,24 +663,24 @@ Sets the **RdbPredicates** to match the field with data type **ValueType** and v
### greaterThan
greaterThan(field: string, value: ValueType): RdbPredicatesgr
greaterThan(field: string, value: ValueType): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **ValueType** and value greater than the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.greaterThan("AGE", 18)
......@@ -609,19 +694,20 @@ lessThan(field: string, value: ValueType): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **ValueType** and value less than the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.lessThan("AGE", 20)
......@@ -636,19 +722,20 @@ greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **ValueType** and value greater than or equal to the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.greaterThanOrEqualTo("AGE", 18)
......@@ -663,19 +750,20 @@ lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **ValueType** and value less than or equal to the specified value.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | [ValueType](#valuetype) | Yes| Value to match the **RdbPredicates**.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.lessThanOrEqualTo("AGE", 20)
......@@ -690,18 +778,19 @@ orderByAsc(field: string): RdbPredicates
Sets the **RdbPredicates** to match the column with values sorted in ascending order.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.orderByAsc("NAME")
......@@ -716,18 +805,19 @@ orderByDesc(field: string): RdbPredicates
Sets the **RdbPredicates** to match the column with values sorted in descending order.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.orderByDesc("AGE")
......@@ -741,17 +831,24 @@ distinct(): RdbPredicates
Sets the **RdbPredicates** to filter out duplicate records.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that can filter out duplicate records.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that can filter out duplicate records.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").distinct("NAME")
rdbStore.query(predicates, ["NAME"])
let promisequery = rdbStore.query(predicates, ["NAME"])
promisequery.then((resultSet) => {
console.log("resultSet column names:" + resultSet.columnNames)
console.log("resultSet column count:" + resultSet.columnCount)
}).catch((err) => {
console.log("query err.")
})
```
......@@ -762,18 +859,19 @@ limitAs(value: number): RdbPredicates
Sets the **RdbPredicates** to specify the maximum number of records.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | number | Yes| Maximum number of records.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| value | number | Yes| Maximum number of records.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that specifies the maximum number of records.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that specifies the maximum number of records.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").limitAs(3)
......@@ -787,18 +885,19 @@ offsetAs(rowOffset: number): RdbPredicates
Sets the **RdbPredicates** to specify the start position of the returned result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rowOffset | number | Yes| Number of rows to offset from the beginning. The value is a positive integer.|
**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|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that specifies the start position of the returned result.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that specifies the start position of the returned result.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").offsetAs(3)
......@@ -812,18 +911,19 @@ groupBy(fields: Array&lt;string&gt;): RdbPredicates
Sets the **RdbPredicates** to group rows that have the same value into summary rows.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| fields | Array&lt;string&gt; | Yes| Names of columns to group.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| fields | Array&lt;string&gt; | Yes| Names of columns to group.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that groups rows with the same value.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that groups rows with the same value.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.groupBy(["AGE", "NAME"])
......@@ -832,23 +932,24 @@ Sets the **RdbPredicates** to group rows that have the same value into summary r
### indexedBy
indexedBy(indexName: string): RdbPredicates
indexedBy(field: string): RdbPredicates
Sets the **RdbPredicates** object to specify the index column.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| indexName | string | Yes| Name of the index column.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Name of the index column.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that specifies the index column.|
**Return value**
- Example
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that specifies the index column.|
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.indexedBy("SALARY_INDEX")
......@@ -862,20 +963,21 @@ in(field: string, value: Array&lt;ValueType&gt;): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **Array&#60;ValueType&#62;** and value within the specified range.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | Array&lt;[ValueType](#valuetype)&gt; | Yes| Array of **ValueType**s to match.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | Array&lt;[ValueType](#valuetype)&gt; | Yes| Array of **ValueType**s to match.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.in("AGE", [18, 20])
......@@ -889,20 +991,21 @@ notIn(field: string, value: Array&lt;ValueType&gt;): RdbPredicates
Sets the **RdbPredicates** to match the field with data type **Array&#60;ValueType&#62;** and value out of the specified range.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | Array&lt;[ValueType](#valuetype)&gt; | Yes| Array of **ValueType**s to match.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| field | string | Yes| Column name in the database table.|
| value | Array&lt;[ValueType](#valuetype)&gt; | Yes| Array of **ValueType**s to match.|
- Return value
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
**Return value**
| Type| Description|
| -------- | -------- |
| [RdbPredicates](#rdbpredicates) | **RdbPredicates** object that matches the specified field.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.notIn("NAME", ["Lisa", "Rose"])
......@@ -920,14 +1023,16 @@ insert(name: string, values: ValuesBucket, callback: AsyncCallback&lt;number&gt;
Inserts a row of data into a table. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the target table.|
| values | [ValuesBucket](#valuesbucket) | Yes| Row of data to insert.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the target table.|
| values | [ValuesBucket](#valuesbucket) | Yes| Row of data to insert.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**Example**
```
const valueBucket = {
"NAME": "Lisa",
......@@ -936,8 +1041,8 @@ Inserts a row of data into a table. This method uses a callback to return the re
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
}
rdbStore.insert("EMPLOYEE", valueBucket, function (err, ret) {
expect(1).assertEqual(ret)
console.log(TAG + "insert first done: " + ret)})
console.log("insert first done: " + ret)
})
```
......@@ -947,18 +1052,20 @@ insert(name: string, values: ValuesBucket):Promise&lt;number&gt;
Inserts a row of data into a table. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the target table.|
| values | [ValuesBucket](#valuesbucket) | Yes| Row of data to insert.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the target table.|
| values | [ValuesBucket](#valuesbucket) | Yes| Row of data to insert.|
- Example
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**Example**
```
const valueBucket = {
"NAME": "Lisa",
......@@ -966,10 +1073,12 @@ Inserts a row of data into a table. This method uses a promise to return the res
"SALARY": 100.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
}
let promise = rdbStore.insert("EMPLOYEE", valueBucket)
promise.then(async (ret) => {
await console.log(TAG + "insert first done: " + ret)
}).catch((err) => {})
let promiseinsert = rdbStore.insert("EMPLOYEE", valueBucket)
promiseinsert.then(async (ret) => {
console.log("insert first done: " + ret)
}).catch((err) => {
console.log("insert err.")
})
```
......@@ -979,14 +1088,16 @@ update(values: ValuesBucket, rdbPredicates: RdbPredicates, callback: AsyncCallba
Updates data in the database based on the specified RdbPredicates object. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| values | [ValuesBucket](#valuesbucket) | Yes| Data to update. The value specifies the row of data to be updated in the database. The key-value pair is associated with the column name in the target table.|
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Row of data to insert.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the number of rows updated.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| values | [ValuesBucket](#valuesbucket) | Yes| Data to update. The value specifies the row of data to be updated in the database. The key-value pair is associated with the column name in the target table.|
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Row of data to insert.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback used to return the number of rows updated.|
**Example**
```
const valueBucket = {
"NAME": "Rose",
......@@ -997,7 +1108,7 @@ Updates data in the database based on the specified RdbPredicates object. This m
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Lisa")
rdbStore.update(valueBucket, predicates, function (err, ret) {
console.log(TAG + "updated row count: " + changedRows)})
console.log("updated row count: " + changedRows)})
```
......@@ -1007,18 +1118,20 @@ update(values: ValuesBucket, rdbPredicates: RdbPredicates):Promise&lt;number&gt;
Updates data in the database based on the specified RdbPredicates object. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| values | [ValuesBucket](#valuesbucket) | Yes| Data to update. The value specifies the row of data to be updated in the database. The key-value pair is associated with the column name in the target table.|
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Row of data to insert.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the number of rows updated.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| values | [ValuesBucket](#valuesbucket) | Yes| Data to update. The value specifies the row of data to be updated in the database. The key-value pair is associated with the column name in the target table.|
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Row of data to insert.|
- Example
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the number of rows updated.|
**Example**
```
const valueBucket = {
"NAME": "Rose",
......@@ -1028,10 +1141,12 @@ Updates data in the database based on the specified RdbPredicates object. This m
}
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Lisa")
let promise = rdbStore.update(valueBucket, predicates)
promise.then(async (ret) => {
await console.log(TAG + "updated row count: " + changedRows)
}).catch((err) => {})
let promiseupdate = rdbStore.update(valueBucket, predicates)
promiseupdate.then(async (ret) => {
console.log("updated row count: " + changedRows)
}).catch((err) => {
console.log("update err.")
})
```
......@@ -1042,19 +1157,21 @@ delete(rdbPredicates: RdbPredicates, callback: AsyncCallback&lt;number&gt;):void
Deletes data from the database based on the specified RdbPredicates object. This method uses a callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Conditions specified for deleting data.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the number of rows deleted.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Conditions specified for deleting data.|
| callback | AsyncCallback&lt;number&gt; | Yes| Callback invoked to return the number of rows updated.|
- Example
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Lisa")
rdbStore.delete(predicates, function (err, rows) {
console.log(TAG + "delete rows: " + rows)})
console.log("delete rows: " + rows)
})
```
......@@ -1064,24 +1181,28 @@ delete(rdbPredicates: RdbPredicates):Promise&lt;number&gt;
Deletes data from the database based on the specified RdbPredicates object. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Conditions specified for deleting data.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the number of rows deleted.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Conditions specified for deleting data.|
- Example
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the number of rows updated.|
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Lisa")
let promise = rdbStore.delete(predicates)
promise.then((rows) => {
console.log(TAG + "delete rows: " + rows)
}).catch((err) => {})
let predicatesdelete = new data_rdb.RdbPredicates("EMPLOYEE")
predicatesdelete.equalTo("NAME", "Lisa")
let promisedelete = rdbStore.delete(predicates)
promisedelete.then((rows) => {
console.log("delete rows: " + rows)
}).catch((err) => {
console.log("delete err.")
})
```
......@@ -1091,20 +1212,23 @@ query(rdbPredicates: RdbPredicates, columns: Array&lt;string&gt;, callback: Asyn
Queries data in the database based on specified conditions. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Query conditions specified by the **RdbPredicates** object.|
| columns | Array&lt;string&gt; | Yes| Columns to query. If this parameter is not specified, the query applies to all columns.|
| callback | AsyncCallback&lt;[ResultSet](js-apis-data-resultset.md)&gt; | Yes| Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Query conditions specified by the **RdbPredicates** object.|
| columns | Array&lt;string&gt; | Yes| Columns to query. If this parameter is not specified, the query applies to all columns.|
| callback | AsyncCallback&lt;[ResultSet](js-apis-data-resultset.md)&gt; | Yes| Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err, resultSet) {
console.log(TAG + "resultSet column names:" + resultSet.columnNames)
console.log(TAG + "resultSet column count:" + resultSet.columnCount)})
console.log("resultSet column names:" + resultSet.columnNames)
console.log("resultSet column count:" + resultSet.columnCount)
})
```
......@@ -1114,25 +1238,30 @@ query(rdbPredicates: RdbPredicates, columns?: Array&lt;string&gt;):Promise&lt;Re
Queries data in the database based on specified conditions. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Query conditions specified by the **RdbPredicates** object.|
| columns | Array&lt;string&gt; | No| Columns to query. If this parameter is not specified, the query applies to all columns.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;[ResultSet](../apis/js-apis-data-resultset.md)&gt; | Promise used to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| rdbPredicates | [RdbPredicates](#rdbpredicates) | Yes| Query conditions specified by the **RdbPredicates** object.|
| columns | Array&lt;string&gt; | No| Columns to query. If this parameter is not specified, the query applies to all columns.|
- Example
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[ResultSet](../apis/js-apis-data-resultset.md)&gt; | Promise used to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**Example**
```
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose")
let promise = rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promise.then((resultSet) => {
console.log(TAG + "resultSet column names:" + resultSet.columnNames)
console.log(TAG + "resultSet column count:" + resultSet.columnCount)})
let promisequery = rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promisequery.then((resultSet) => {
console.log("resultSet column names:" + resultSet.columnNames)
console.log("resultSet column count:" + resultSet.columnCount)
}).catch((err) => {
console.log("query err.")
})
```
......@@ -1142,18 +1271,21 @@ querySql(sql: string, bindArgs: Array&lt;ValueType&gt;, callback: AsyncCallback&
Queries data in the RDB store using the specified SQL statement. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| sql | string | Yes| SQL statement to run.|
| bindArgs | Array&lt;[ValueType](#valuetype)&gt; | Yes| Values of the parameters in the SQL statement.|
| callback | AsyncCallback&lt;[ResultSet](js-apis-data-resultset.md)&gt; | Yes| Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| sql | string | Yes| SQL statement to run.|
| bindArgs | Array&lt;[ValueType](#valuetype)&gt; | Yes| Values of the parameters in the SQL statement.|
| callback | AsyncCallback&lt;[ResultSet](js-apis-data-resultset.md)&gt; | Yes| Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**Example**
```
rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo'], function (err, resultSet) {
console.log(TAG + "resultSet column names:" + resultSet.columnNames)
console.log(TAG + "resultSet column count:" + resultSet.columnCount)})
console.log("resultSet column names:" + resultSet.columnNames)
console.log("resultSet column count:" + resultSet.columnCount)
})
```
......@@ -1163,23 +1295,28 @@ querySql(sql: string, bindArgs?: Array&lt;ValueType&gt;):Promise&lt;ResultSet&gt
Queries data in the RDB store using the specified SQL statement. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| sql | string | Yes| SQL statement to run.|
| bindArgs | Array&lt;[ValueType](#valuetype)&gt; | No| Values of the parameters in the SQL statement.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;[ResultSet](../apis/js-apis-data-resultset.md)&gt; | Promise used to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| sql | string | Yes| SQL statement to run.|
| bindArgs | Array&lt;[ValueType](#valuetype)&gt; | No| Values of the parameters in the SQL statement.|
- Example
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;[ResultSet](../apis/js-apis-data-resultset.md)&gt; | Promise used to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**Example**
```
let promise = rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo'])
promise.then((resultSet) => {
console.log(TAG + "resultSet column names:" + resultSet.columnNames)
console.log(TAG + "resultSet column count:" + resultSet.columnCount)})
let promisequerySql = rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo'])
promisequerySql.then((resultSet) => {
console.log("resultSet column names:" + resultSet.columnNames)
console.log("resultSet column count:" + resultSet.columnCount)
}).catch((err) => {
console.log("querySql err.")
})
```
......@@ -1189,17 +1326,20 @@ executeSql(sql: string, bindArgs: Array&lt;ValueType&gt;, callback: AsyncCallbac
Runs the SQL statement that contains the specified parameters but does not return a value. This method uses a callback to return the execution result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| sql | string | Yes| SQL statement to run.|
| bindArgs | Array&lt;[ValueType](#valuetype)&gt; | Yes| Values of the parameters in the SQL statement.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| sql | string | Yes| SQL statement to run.|
| bindArgs | Array&lt;[ValueType](#valuetype)&gt; | Yes| Values of the parameters in the SQL statement.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result.|
**Example**
```
rdbStore.executeSql("DELETE FROM EMPLOYEE", null, function () {
console.info(TAG + 'delete done.')})
console.info('delete done.')
})
```
......@@ -1209,37 +1349,122 @@ executeSql(sql: string, bindArgs?: Array&lt;ValueType&gt;):Promise&lt;void&gt;
Runs the SQL statement that contains the specified parameters but does not return a value. This method uses a promise to return the execution result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| sql | string | Yes| SQL statement to run.|
| bindArgs | Array&lt;[ValueType](#valuetype)&gt; | No| Values of the parameters in the SQL statement.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| sql | string | Yes| SQL statement to run.|
| bindArgs | Array&lt;[ValueType](#valuetype)&gt; | No| Values of the parameters in the SQL statement.|
- Example
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```
let promise = rdbStore.executeSql("DELETE FROM EMPLOYEE")
promise.then(() => {
console.info(TAG + 'delete done.')})
let promiseexecuteSql = rdbStore.executeSql("DELETE FROM EMPLOYEE")
promiseexecuteSql.then(() => {
console.info('delete done.')
}).catch((err) => {
console.log("executeSql err.")
})
```
### setDistributedTables
### beginTransaction<sup>8+</sup>
beginTransaction():void
Starts the transaction before executing an SQL statement.
setDistributedTables(tables: Array<string>, callback: AsyncCallback<void>): void;
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Example**
```
rdbStore.beginTransaction()
const valueBucket = {
"name": "lisi",
"age": 18,
"salary": 100.5,
"blobType": new Uint8Array([1, 2, 3]),
}
rdbStore.insert("test", valueBucket, function (err, ret) {
console.log("insert done: " + ret)
})
rdbStore.commit()
```
### commit<sup>8+</sup>
commit():void
Commits the executed SQL statements.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Example**
```
rdbStore.beginTransaction()
const valueBucket = {
"name": "lisi",
"age": 18,
"salary": 100.5,
"blobType": new Uint8Array([1, 2, 3]),
}
rdbStore.insert("test", valueBucket, function (err, ret) {
console.log("insert done: " + ret)
})
rdbStore.commit()
```
### rollBack<sup>8+</sup>
rollBack():void;
Rolls back the SQL statements that have been executed.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Example**
```
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) {
console.log("insert done: " + ret)
})
rdbStore.commit()
} catch (e) {
rdbStore.rollBack()
}
```
### setDistributedTables<sup>8+</sup>
setDistributedTables(tables: Array&lt;string&gt;, callback: AsyncCallback&lt;void&gt;): void
Sets a list of distributed tables. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| tables | Array<string> | Yes| Names of the distributed tables to be set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| tables | Array&lt;string&gt; | Yes| Names of the distributed tables to set.|
| callback | AsyncCallback&lt;void&gt; | Yes| Callback invoked to return the result.|
**Example**
```
rdbStore.setDistributedTables(["EMPLOYEE"], function (err) {
if (err) {
......@@ -1251,46 +1476,50 @@ Sets a list of distributed tables. This method uses a callback to return the res
```
### setDistributedTables
### setDistributedTables<sup>8+</sup>
setDistributedTables(tables: Array<string>): Promise<void>;
setDistributedTables(tables: Array&lt;string&gt;): Promise&lt;void&gt;
Sets a list of distributed tables. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| tables | Array<string> | Yes| Names of the distributed tables to be set.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| tables | Array&lt;string&gt; | Yes| Names of the distributed tables to set.|
- Example
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```
let promise = rdbStore.setDistributedTables(["EMPLOYEE"])
promise.then(() => {
let promiseset = rdbStore.setDistributedTables(["EMPLOYEE"])
promiseset.then(() => {
console.info("setDistributedTables success.")
}).catch((err) => {
console.info("setDistributedTables failed."")
console.info("setDistributedTables failed.")
})
```
### obtainDistributedTableName
### obtainDistributedTableName<sup>8+</sup>
obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void;
obtainDistributedTableName(device: string, table: string, callback: AsyncCallback&lt;string&gt;): void
Obtains the distributed table name for a remote device based on the local table name. The distributed table name is required when the database of a remote device is queried. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | string | Yes| Remote device.|
| table | string | Yes| Local table name.|
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the result. If the operation succeeds, the distributed table name of the remote device is returned.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | string | Yes| Remote device.|
| table | string | Yes| Local table name.|
| callback | AsyncCallback&lt;string&gt; | Yes| Callback invoked to return the result. If the operation succeeds, the distributed table name of the remote device is returned.|
**Example**
```
rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) {
if (err) {
......@@ -1302,47 +1531,51 @@ Obtains the distributed table name for a remote device based on the local table
```
### obtainDistributedTableName
### obtainDistributedTableName<sup>8+</sup>
obtainDistributedTableName(device: string, table: string): Promise<string>;
obtainDistributedTableName(device: string, table: string): Promise&lt;string&gt;
Obtains the distributed table name for a remote device based on the local table name. The distributed table name is required when the database of a remote device is queried. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | string | Yes| Remote device.|
| table | string | Yes| Local table name.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | string | Yes| Remote device.|
| table | string | Yes| Local table name.|
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;string&gt; | Promise used to return the result. If the operation succeeds, the distributed table name of the remote device is returned.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;string&gt; | Promise used to return the result. If the operation succeeds, the distributed table name of the remote device is returned.|
- Example
**Example**
```
let promise = rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE")
promise.then((tableName) => {
let promiseDistr = rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE")
promiseDistr.then((tableName) => {
console.info('obtainDistributedTableName success, tableName=' + tableName)
}).catch((err) => {
console.info('obtainDistributedTableName failed.')
})
```
### sync
### sync<sup>8+</sup>
sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array<[string, number]>>): void;
sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback&lt;Array&lt;[string, number]&gt;&gt;): void
Synchronizes data between devices. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| mode | SyncMode | Yes| Data synchronization mode, which can be **push** or **pull**.|
| predicates | RdbPredicates | Yes| **RdbPredicates** object that specifies the data and devices to synchronize.|
| callback | AsyncCallback&lt;Array<[string, number]>&gt; | Yes| Callback invoked to send the synchronization result to the caller. <br>**string** indicates the device ID. <br>**number** indicates the synchronization status of each device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. |
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| mode | [SyncMode](#syncmode8) | Yes| Data synchronization mode. The value can be **push** or **pull**.|
| predicates | [RdbPredicates](#rdbpredicates) | Yes| **RdbPredicates** object that specifies the data and devices to synchronize.|
| callback | AsyncCallback&lt;Array&lt;[string, number]&gt;&gt; | Yes| Callback invoked to send the synchronization result to the caller. <br>**string** indicates the device ID. <br>**number** indicates the synchronization status of each device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. |
**Example**
```
let predicate = new rdb.RdbPredicates('EMPLOYEE')
predicate.inDevices(['12345678abcde'])
......@@ -1359,77 +1592,89 @@ Synchronizes data between devices. This method uses a callback to return the res
```
### sync
### sync<sup>8+</sup>
sync(mode: SyncMode, predicates: RdbPredicates): Promise<Array<[string, number]>>;
sync(mode: SyncMode, predicates: RdbPredicates): Promise&lt;Array&lt;[string, number]&gt;&gt;
Synchronizes data between devices. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| mode | SyncMode | Yes| Data synchronization mode, which can be **push** or **pull**.|
| predicates | RdbPredicates | Yes| **RdbPredicates** object that specifies the data and devices to synchronize.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| Promise&lt;Array<[string, number]>&gt; | Promise used to return the synchronization result to the caller. <br>**string** indicates the device ID. <br>**number** indicates the synchronization status of each device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. |
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| mode | [SyncMode](#syncmode8) | Yes| Data synchronization mode. The value can be **push** or **pull**.|
| predicates | [RdbPredicates](#rdbpredicates) | Yes| **RdbPredicates** object that specifies the data and devices to synchronize.|
- Example
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;Array&lt;[string, number]&gt;&gt; | Promise used to return the synchronization result to the caller. <br>**string** indicates the device ID. <br>**number** indicates the synchronization status of each device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. |
**Example**
```
let predicate = new rdb.RdbPredicates('EMPLOYEE')
predicate.inDevices(['12345678abcde'])
let promise = rdbStore.sync(rdb.SyncMode.SYNC_MODE_PUSH, predicate)
promise.then(result) {
let predicatesync = new data_rdb.RdbPredicates('EMPLOYEE')
predicatesync.inDevices(['12345678abcde'])
let promisesync = rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicatesync)
promisesync.then((result) =>{
console.log('sync done.')
for (let i = 0; i < result.length; i++) {
console.log('device=' + result[i][0] + ' status=' + result[i][1])
}
}).catch((err) => {
console.log('sync failed')
})
}).catch((err) => {
console.log('sync failed')
})
```
### on
### on('dataChange')<sup>8+</sup>
on(event: 'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void;
on(event: 'dataChange', type: SubscribeType, observer: Callback&lt;Array&lt;string&gt;&gt;): void
Registers an observer for this RDB store. When the data in the RDB store changes, a callback is invoked to return the data changes.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | SubscribeType | Yes| Type defined in **SubscribeType**.|
| observer | Callback<Array<string>> | Yes| Observer that listens for the data changes in the RDB store.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | string | Yes| The value is'dataChange', which indicates a data change event.|
| type | [SubscribeType](#subscribetype8) | Yes| Type defined in **SubscribeType**.|
| observer | Callback&lt;Array&lt;string&gt;&gt; | Yes| Observer that listens for the data changes in the RDB store.|
**Example**
```
function storeObserver(devices) {
for (let i = 0; i < devices.length; i++) {
console.log('device=' + device[i] + ' data changed')
}
}
try {
rdbStore.on('dataChange', rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver)
} catch (err) {
console.log('register observer failed')
}
}
}
try {
rdbStore.on('dataChange', data_rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver)
} catch (err) {
console.log('register observer failed')
}
```
### off
### off('dataChange')<sup>8+</sup>
off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void;
off(event:'dataChange', type: SubscribeType, observer: Callback&lt;Array&lt;string&gt;&gt;): void
Deletes the specified observer of the RDB store. This method uses a callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | SubscribeType | Yes| Type defined in **SubscribeType**.|
| observer | Callback<Array<string>> | Yes| Data change observer registered.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| event | string | Yes| The value is'dataChange', which indicates a data change event.|
| type | [SubscribeType](#subscribetype8) | Yes| Type defined in **SubscribeType**.|
| observer | Callback&lt;Array&lt;string&gt;&gt; | Yes| Data change observer registered.|
**Example**
- Example
```
function storeObserver(devices) {
for (let i = 0; i < devices.length; i++) {
......@@ -1437,7 +1682,7 @@ Deletes the specified observer of the RDB store. This method uses a callback to
}
}
try {
rdbStore.off('dataChange', rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver)
rdbStore.off('dataChange', data_rdb.SubscribeType.SUBSCRIBE_TYPE_REMOTE, storeObserver)
} catch (err) {
console.log('unregister observer failed')
}
......@@ -1448,6 +1693,8 @@ Deletes the specified observer of the RDB store. This method uses a callback to
Manages the configuration of an RDB store.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Database file name.|
......@@ -1457,6 +1704,8 @@ Manages the configuration of an RDB store.
Defines the data types allowed.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name| Description|
| -------- | -------- |
| number | Number.|
......@@ -1468,25 +1717,30 @@ Defines the data types allowed.
Defines a bucket to store key-value pairs.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| [key:&nbsp;string] | [ValueType](#valuetype)\|&nbsp;Uint8Array&nbsp;\|&nbsp;null | Yes| Defines a bucket to store key-value pairs.|
## SyncMode
## SyncMode<sup>8+</sup>
Defines the database synchronization mode.
| Name| Description|
| -------- | -------- |
| SYNC_MODE_PUSH | Data is pushed from a local device to a remote device.|
| SYNC_MODE_PULL | Data is loaded from a remote device to a local device.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name | Default Value| Description|
| -------- | ----- |----- |
| SYNC_MODE_PUSH | 0 | Data is pushed from a local device to a remote device.|
| SYNC_MODE_PULL | 1 | Data is pulled from a remote device to a local device.|
## SubscribeType
## SubscribeType<sup>8+</sup>
Defines the subscription type.
| Name| Description|
| -------- | -------- |
| SUBSCRIBE_TYPE_REMOTE | Subscribe to remote data changes.|
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name | Default Value| Description|
| -------- | ----- |---- |
| SUBSCRIBE_TYPE_REMOTE | 0 | Subscribe to remote data changes.|
# Result Set<a name="EN-US_TOPIC_0000001159793150"></a>
# Result Set
>![](../../public_sys-resources/icon-note.gif) **NOTE**
>
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## System Capabilities
SystemCapability.DistributedDataManager.RelationalStore.Core
## Usage<a name="section42211227142416"></a>
## Usage
The **resultSet** object is obtained by using [**RdbStore.query\(\)**](js-apis-data-rdb.md#query).
You need to use [RdbStore.query()](js-apis-data-rdb.md#query) to obtain the **resultSet** object.
```
import dataRdb from '@ohos.data.rdb';
......@@ -17,779 +14,392 @@ 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);
console.log(TAG + "resultSet columnNames:" + resultSet.columnNames);
console.log(TAG + "resultSet columnCount:" + resultSet.columnCount);})
```
## ResultSet<a name="section12882825611"></a>
Provides methods to access the result set, which is obtained by querying the relational database \(RDB\) store.
### Attributes<a name="section33371914134316"></a>
<a name="table184922044316"></a>
<table><thead align="left"><tr id="row1649212018436"><th class="cellrowborder" valign="top" width="17.911791179117913%" id="mcps1.1.5.1.1"><p id="p9493140124311"><a name="p9493140124311"></a><a name="p9493140124311"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="12.291229122912291%" id="mcps1.1.5.1.2"><p id="p11493190144319"><a name="p11493190144319"></a><a name="p11493190144319"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="10.551055105510551%" id="mcps1.1.5.1.3"><p id="p124942015436"><a name="p124942015436"></a><a name="p124942015436"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="59.245924592459254%" id="mcps1.1.5.1.4"><p id="p19494800433"><a name="p19494800433"></a><a name="p19494800433"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row6494500437"><td class="cellrowborder" valign="top" width="17.911791179117913%" headers="mcps1.1.5.1.1 "><p id="p1349412074317"><a name="p1349412074317"></a><a name="p1349412074317"></a>columnNames</p>
</td>
<td class="cellrowborder" valign="top" width="12.291229122912291%" headers="mcps1.1.5.1.2 "><p id="p114948074319"><a name="p114948074319"></a><a name="p114948074319"></a>Array&lt;string&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="10.551055105510551%" headers="mcps1.1.5.1.3 "><p id="p16495803434"><a name="p16495803434"></a><a name="p16495803434"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.245924592459254%" headers="mcps1.1.5.1.4 "><p id="p1149515020434"><a name="p1149515020434"></a><a name="p1149515020434"></a>Names of all columns in the result set.</p>
</td>
</tr>
<tr id="row249530144319"><td class="cellrowborder" valign="top" width="17.911791179117913%" headers="mcps1.1.5.1.1 "><p id="p64951908431"><a name="p64951908431"></a><a name="p64951908431"></a>columnCount</p>
</td>
<td class="cellrowborder" valign="top" width="12.291229122912291%" headers="mcps1.1.5.1.2 "><p id="p14495701434"><a name="p14495701434"></a><a name="p14495701434"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="10.551055105510551%" headers="mcps1.1.5.1.3 "><p id="p164954074314"><a name="p164954074314"></a><a name="p164954074314"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.245924592459254%" headers="mcps1.1.5.1.4 "><p id="p114957010437"><a name="p114957010437"></a><a name="p114957010437"></a>Number of columns in the result set.</p>
</td>
</tr>
<tr id="row2497204431"><td class="cellrowborder" valign="top" width="17.911791179117913%" headers="mcps1.1.5.1.1 "><p id="p154973074312"><a name="p154973074312"></a><a name="p154973074312"></a>rowCount</p>
</td>
<td class="cellrowborder" valign="top" width="12.291229122912291%" headers="mcps1.1.5.1.2 "><p id="p134972004438"><a name="p134972004438"></a><a name="p134972004438"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="10.551055105510551%" headers="mcps1.1.5.1.3 "><p id="p849720094317"><a name="p849720094317"></a><a name="p849720094317"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.245924592459254%" headers="mcps1.1.5.1.4 "><p id="p849720184311"><a name="p849720184311"></a><a name="p849720184311"></a>Number of rows in the result set.</p>
</td>
</tr>
<tr id="row149711094313"><td class="cellrowborder" valign="top" width="17.911791179117913%" headers="mcps1.1.5.1.1 "><p id="p6498408432"><a name="p6498408432"></a><a name="p6498408432"></a>rowIndex</p>
</td>
<td class="cellrowborder" valign="top" width="12.291229122912291%" headers="mcps1.1.5.1.2 "><p id="p104984004313"><a name="p104984004313"></a><a name="p104984004313"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="10.551055105510551%" headers="mcps1.1.5.1.3 "><p id="p17498190154315"><a name="p17498190154315"></a><a name="p17498190154315"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.245924592459254%" headers="mcps1.1.5.1.4 "><p id="p1149840134313"><a name="p1149840134313"></a><a name="p1149840134313"></a>Index of the current row in the result set.</p>
</td>
</tr>
<tr id="row15498140174314"><td class="cellrowborder" valign="top" width="17.911791179117913%" headers="mcps1.1.5.1.1 "><p id="p1249814011437"><a name="p1249814011437"></a><a name="p1249814011437"></a>isAtFirstRow</p>
</td>
<td class="cellrowborder" valign="top" width="12.291229122912291%" headers="mcps1.1.5.1.2 "><p id="p174996019439"><a name="p174996019439"></a><a name="p174996019439"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="10.551055105510551%" headers="mcps1.1.5.1.3 "><p id="p16499140134318"><a name="p16499140134318"></a><a name="p16499140134318"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.245924592459254%" headers="mcps1.1.5.1.4 "><p id="p54998044315"><a name="p54998044315"></a><a name="p54998044315"></a>Specifies whether the cursor is in the first row of the result set.</p>
</td>
</tr>
<tr id="row154995015437"><td class="cellrowborder" valign="top" width="17.911791179117913%" headers="mcps1.1.5.1.1 "><p id="p2499105436"><a name="p2499105436"></a><a name="p2499105436"></a>isAtLastRow</p>
</td>
<td class="cellrowborder" valign="top" width="12.291229122912291%" headers="mcps1.1.5.1.2 "><p id="p749910014314"><a name="p749910014314"></a><a name="p749910014314"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="10.551055105510551%" headers="mcps1.1.5.1.3 "><p id="p154993020433"><a name="p154993020433"></a><a name="p154993020433"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.245924592459254%" headers="mcps1.1.5.1.4 "><p id="p1950010017432"><a name="p1950010017432"></a><a name="p1950010017432"></a>Whether the cursor is in the last row of the result set.</p>
</td>
</tr>
<tr id="row250016064319"><td class="cellrowborder" valign="top" width="17.911791179117913%" headers="mcps1.1.5.1.1 "><p id="p75008017436"><a name="p75008017436"></a><a name="p75008017436"></a>isEnded</p>
</td>
<td class="cellrowborder" valign="top" width="12.291229122912291%" headers="mcps1.1.5.1.2 "><p id="p050017016431"><a name="p050017016431"></a><a name="p050017016431"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="10.551055105510551%" headers="mcps1.1.5.1.3 "><p id="p1850018010431"><a name="p1850018010431"></a><a name="p1850018010431"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.245924592459254%" headers="mcps1.1.5.1.4 "><p id="p1650013017433"><a name="p1650013017433"></a><a name="p1650013017433"></a>Whether the cursor is after the last row of the result set.</p>
</td>
</tr>
<tr id="row125001014315"><td class="cellrowborder" valign="top" width="17.911791179117913%" headers="mcps1.1.5.1.1 "><p id="p18501140164316"><a name="p18501140164316"></a><a name="p18501140164316"></a>isStarted</p>
</td>
<td class="cellrowborder" valign="top" width="12.291229122912291%" headers="mcps1.1.5.1.2 "><p id="p16501100184315"><a name="p16501100184315"></a><a name="p16501100184315"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="10.551055105510551%" headers="mcps1.1.5.1.3 "><p id="p175019011436"><a name="p175019011436"></a><a name="p175019011436"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.245924592459254%" headers="mcps1.1.5.1.4 "><p id="p1834523310411"><a name="p1834523310411"></a><a name="p1834523310411"></a>Whether the cursor has been moved.</p>
</td>
</tr>
<tr id="row9501509438"><td class="cellrowborder" valign="top" width="17.911791179117913%" headers="mcps1.1.5.1.1 "><p id="p1502200124310"><a name="p1502200124310"></a><a name="p1502200124310"></a>isClosed</p>
</td>
<td class="cellrowborder" valign="top" width="12.291229122912291%" headers="mcps1.1.5.1.2 "><p id="p2503705432"><a name="p2503705432"></a><a name="p2503705432"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="10.551055105510551%" headers="mcps1.1.5.1.3 "><p id="p1350316017434"><a name="p1350316017434"></a><a name="p1350316017434"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.245924592459254%" headers="mcps1.1.5.1.4 "><p id="p35031016433"><a name="p35031016433"></a><a name="p35031016433"></a>Whether the result set is closed.</p>
</td>
</tr>
</tbody>
</table>
### getColumnIndex<a name="section1157339392"></a>
getColumnIndex\(columnName: string\): number
Obtains the column index based on the specified column name.
- Parameters
<a name="table61855294472"></a>
<table><thead align="left"><tr id="row1918613293479"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p2186132919477"><a name="p2186132919477"></a><a name="p2186132919477"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p718722912476"><a name="p718722912476"></a><a name="p718722912476"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p618792944710"><a name="p618792944710"></a><a name="p618792944710"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p718862924711"><a name="p718862924711"></a><a name="p718862924711"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row918872914715"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p718817293472"><a name="p718817293472"></a><a name="p718817293472"></a>columnName</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1189629144710"><a name="p1189629144710"></a><a name="p1189629144710"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p1318942916474"><a name="p1318942916474"></a><a name="p1318942916474"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p151891829124715"><a name="p151891829124715"></a><a name="p151891829124715"></a>Name of the column.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table20961651020"></a>
<table><thead align="left"><tr id="row169621556217"><th class="cellrowborder" valign="top" width="15.15%" id="mcps1.1.3.1.1"><p id="p12962451327"><a name="p12962451327"></a><a name="p12962451327"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="84.85000000000001%" id="mcps1.1.3.1.2"><p id="p1196210517216"><a name="p1196210517216"></a><a name="p1196210517216"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1696211520212"><td class="cellrowborder" valign="top" width="15.15%" headers="mcps1.1.3.1.1 "><p id="p149621851328"><a name="p149621851328"></a><a name="p149621851328"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="84.85000000000001%" headers="mcps1.1.3.1.2 "><p id="p149631953213"><a name="p149631953213"></a><a name="p149631953213"></a>Index of the column.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
resultSet.goToFirstRow()
const id = resultSet.getLong(resultSet.getColumnIndex("ID"))
const name = resultSet.getString(resultSet.getColumnIndex("NAME"))
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"))
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"))
```
### getColumnName<a name="section17443163225511"></a>
getColumnName\(columnIndex: number\): string
Obtains the column name based on the specified column index.
- Parameters
<a name="table44884315584"></a>
<table><thead align="left"><tr id="row1449204375812"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p149174310589"><a name="p149174310589"></a><a name="p149174310589"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1249643135817"><a name="p1249643135817"></a><a name="p1249643135817"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p8503435582"><a name="p8503435582"></a><a name="p8503435582"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1650104325819"><a name="p1650104325819"></a><a name="p1650104325819"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row115034345817"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p573310187592"><a name="p573310187592"></a><a name="p573310187592"></a>columnIndex</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p2073318189597"><a name="p2073318189597"></a><a name="p2073318189597"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p1573417187599"><a name="p1573417187599"></a><a name="p1573417187599"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p773411814590"><a name="p773411814590"></a><a name="p773411814590"></a>Index of the column.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table55311436588"></a>
<table><thead align="left"><tr id="row165424395811"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.3.1.1"><p id="p16541943185810"><a name="p16541943185810"></a><a name="p16541943185810"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="85.18%" id="mcps1.1.3.1.2"><p id="p1254174318583"><a name="p1254174318583"></a><a name="p1254174318583"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row20547439582"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.3.1.1 "><p id="p14837301096"><a name="p14837301096"></a><a name="p14837301096"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="85.18%" headers="mcps1.1.3.1.2 "><p id="p65510438580"><a name="p65510438580"></a><a name="p65510438580"></a>Name of the column.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
const id = resultSet.getColumnName(0)
const name = resultSet.getColumnName(1)
const age = resultSet.getColumnName(2)
```
### goTo<a name="section495110570014"></a>
goTo\(offset:number\): boolean
## ResultSet
Provides methods to access the result set, which is obtained by querying the relational database (RDB) store.
### Attributes
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnNames | Array&lt;string&gt; | Yes| Names of all columns in the result set.|
| columnCount | number | Yes| Number of columns in the result set.|
| rowCount | number | Yes| Number of rows in the result set.|
| rowIndex | number | Yes| Index of the current row in the result set.|
| isAtFirstRow | boolean | Yes| Whether the cursor is in the first row of the result set.|
| isAtLastRow | boolean | Yes| Whether the cursor is in the last row of the result set.|
| isEnded | boolean | Yes| Whether the cursor is after the last row of the result set.|
| isStarted | boolean | Yes| Whether the cursor has been moved.|
| isClosed | boolean | Yes| Whether the result set is closed.|
### getColumnIndex
getColumnIndex(columnName: string): number
Obtains the column index based on the column name.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnName | string | Yes| Column name specified.|
- Return value
| Type| Description|
| -------- | -------- |
| number | Index of the column obtained.|
- Example
```
resultSet.goToFirstRow()
const id = resultSet.getLong(resultSet.getColumnIndex("ID"))
const name = resultSet.getString(resultSet.getColumnIndex("NAME"))
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"))
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"))
```
### getColumnName
getColumnName(columnIndex: number): string
Obtains the column name based on the column index.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Column index specified.|
- Return value
| Type| Description|
| -------- | -------- |
| string | Column name obtained.|
- Example
```
const id = resultSet.getColumnName(0)
const name = resultSet.getColumnName(1)
const age = resultSet.getColumnName(2)
```
### goTo
goTo(offset:number): boolean
Moves the cursor to the row based on the specified offset.
- Parameters
<a name="table82202318612"></a>
<table><thead align="left"><tr id="row1722117320618"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p922123068"><a name="p922123068"></a><a name="p922123068"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p722110316612"><a name="p722110316612"></a><a name="p722110316612"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p0222173662"><a name="p0222173662"></a><a name="p0222173662"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p92228310614"><a name="p92228310614"></a><a name="p92228310614"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row0223634620"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p522412314614"><a name="p522412314614"></a><a name="p522412314614"></a>offset</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1122423760"><a name="p1122423760"></a><a name="p1122423760"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p62241733616"><a name="p62241733616"></a><a name="p62241733616"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p154152015121913"><a name="p154152015121913"></a><a name="p154152015121913"></a>Offset relative to the current position.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table7733112152018"></a>
<table><thead align="left"><tr id="row5734182152014"><th class="cellrowborder" valign="top" width="14.92%" id="mcps1.1.3.1.1"><p id="p973417213203"><a name="p973417213203"></a><a name="p973417213203"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="85.08%" id="mcps1.1.3.1.2"><p id="p3734721152012"><a name="p3734721152012"></a><a name="p3734721152012"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row573416215206"><td class="cellrowborder" valign="top" width="14.92%" headers="mcps1.1.3.1.1 "><p id="p273515212203"><a name="p273515212203"></a><a name="p273515212203"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="85.08%" headers="mcps1.1.3.1.2 "><p id="p12204124792912"><a name="p12204124792912"></a><a name="p12204124792912"></a>Returns <strong id="b16588123663312"><a name="b16588123663312"></a><a name="b16588123663312"></a>true</strong> if the operation is successful; returns <strong id="b734714415343"><a name="b734714415343"></a><a name="b734714415343"></a>false</strong> otherwise.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goTo(1);
resultSet.close();
resultSet = null;
})
```
### goToRow<a name="section1162235119"></a>
goToRow\(position: number\): boolean
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| offset | number | Yes| Offset relative to the current position.|
- Return value
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
- Example
```
let predicatesgoto = new dataRdb.RdbPredicates("EMPLOYEE")
let promisequerygoto = rdbStore.query(predicatesgoto, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promisequerygoto.then((resultSet) {
resultSet.goTo(1)
resultSet.close()
}).catch((err) => {
console.log('query failed')
})
```
### goToRow
goToRow(position: number): boolean
Moves the cursor to the specified row in the result set.
- Parameters
<a name="table1990643911123"></a>
<table><thead align="left"><tr id="row390715391128"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p13907239181212"><a name="p13907239181212"></a><a name="p13907239181212"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p4907113971210"><a name="p4907113971210"></a><a name="p4907113971210"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p13907139111212"><a name="p13907139111212"></a><a name="p13907139111212"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p190853910127"><a name="p190853910127"></a><a name="p190853910127"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row11908139101217"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p1190883981219"><a name="p1190883981219"></a><a name="p1190883981219"></a>position</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p16908133921214"><a name="p16908133921214"></a><a name="p16908133921214"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p199085397128"><a name="p199085397128"></a><a name="p199085397128"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1690919394126"><a name="p1690919394126"></a><a name="p1690919394126"></a>Position to which the cursor is to be moved.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table252182410125"></a>
<table><thead align="left"><tr id="row352192441218"><th class="cellrowborder" valign="top" width="14.499999999999998%" id="mcps1.1.3.1.1"><p id="p8522172471215"><a name="p8522172471215"></a><a name="p8522172471215"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="85.5%" id="mcps1.1.3.1.2"><p id="p19522424121213"><a name="p19522424121213"></a><a name="p19522424121213"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row11522112418127"><td class="cellrowborder" valign="top" width="14.499999999999998%" headers="mcps1.1.3.1.1 "><p id="p820215291665"><a name="p820215291665"></a><a name="p820215291665"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="85.5%" headers="mcps1.1.3.1.2 "><p id="p1752322401217"><a name="p1752322401217"></a><a name="p1752322401217"></a>Returns <strong id="b1099443431"><a name="b1099443431"></a><a name="b1099443431"></a>true</strong> if the operation is successful; returns <strong id="b578907770"><a name="b578907770"></a><a name="b578907770"></a>false</strong> otherwise.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goToRow(1);
resultSet.close();
resultSet = null
})
```
### goToFirstRow<a name="section1458053411419"></a>
goToFirstRow\(\): boolean
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
Moves the cursor to the first row of the result set.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| position | number | Yes| Position to which the cursor is to be moved.|
- Return value
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
- Return values
- Example
```
let predicatesgotorow = new dataRdb.RdbPredicates("EMPLOYEE")
let promisequerygotorow = rdbStore.query(predicatesgotorow, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promisequerygotorow.then((resultSet) {
resultSet.goToRow(5)
resultSet.close()
}).catch((err) => {
console.log('query failed')
})
```
<a name="table581620571583"></a>
<table><thead align="left"><tr id="row8817357582"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p581720571487"><a name="p581720571487"></a><a name="p581720571487"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p28177571812"><a name="p28177571812"></a><a name="p28177571812"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1581819571083"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p2818757583"><a name="p2818757583"></a><a name="p2818757583"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p981814572814"><a name="p981814572814"></a><a name="p981814572814"></a>Returns <strong id="b1993345723418"><a name="b1993345723418"></a><a name="b1993345723418"></a>true</strong> if the operation is successful; returns <strong id="b18933195712348"><a name="b18933195712348"></a><a name="b18933195712348"></a>false</strong> otherwise.</p>
</td>
</tr>
</tbody>
</table>
- Example
### goToFirstRow
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goToFirstRow();
resultSet.close();
resultSet = null;
})
```
goToFirstRow(): boolean
### goToLastRow<a name="section131488532183"></a>
Moves the cursor to the first row of the result set.
goToLastRow\(\): boolean
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
Moves the cursor to the last row of the result set.
- Return value
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
- Return values
- Example
```
let predicatesgoFirst = new dataRdb.RdbPredicates("EMPLOYEE")
let promisequerygoFirst = rdbStore.query(predicatesgoFirst, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promisequerygoFirst.then((resultSet) {
resultSet.goToFirstRow()
resultSet.close()
}).catch((err) => {
console.log('query failed')
})
```
<a name="table111835692010"></a>
<table><thead align="left"><tr id="row1218486192019"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p14184156122019"><a name="p14184156122019"></a><a name="p14184156122019"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p31851267207"><a name="p31851267207"></a><a name="p31851267207"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row918596122015"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p24019212106"><a name="p24019212106"></a><a name="p24019212106"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p18463621131018"><a name="p18463621131018"></a><a name="p18463621131018"></a>Returns <strong id="b1193716576345"><a name="b1193716576345"></a><a name="b1193716576345"></a>true</strong> if the operation is successful; returns <strong id="b1793795713418"><a name="b1793795713418"></a><a name="b1793795713418"></a>false</strong> otherwise.</p>
</td>
</tr>
</tbody>
</table>
- Example
### goToLastRow
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goToLastRow();
resultSet.close();
resultSet = null;
})
```
goToLastRow(): boolean
Moves the cursor to the last row of the result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
- Example
```
let predicatesgoLast = new dataRdb.RdbPredicates("EMPLOYEE")
let promisequerygoLast = rdbStore.query(predicatesgoLast, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promisequerygoLast.then((resultSet) {
resultSet.goToLastRow()
resultSet.close()
}).catch((err) => {
console.log('query failed')
})
```
### goToNextRow<a name="section6231155031814"></a>
goToNextRow\(\): boolean
### goToNextRow
goToNextRow(): boolean
Moves the cursor to the next row in the result set.
- Return values
<a name="table1725123651220"></a>
<table><thead align="left"><tr id="row18251136141218"><th class="cellrowborder" valign="top" width="30.44%" id="mcps1.1.3.1.1"><p id="p1625536181217"><a name="p1625536181217"></a><a name="p1625536181217"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.56%" id="mcps1.1.3.1.2"><p id="p152573616122"><a name="p152573616122"></a><a name="p152573616122"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1225436121214"><td class="cellrowborder" valign="top" width="30.44%" headers="mcps1.1.3.1.1 "><p id="p32543691211"><a name="p32543691211"></a><a name="p32543691211"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="69.56%" headers="mcps1.1.3.1.2 "><p id="p16261236141219"><a name="p16261236141219"></a><a name="p16261236141219"></a>Returns <strong id="b12940175783420"><a name="b12940175783420"></a><a name="b12940175783420"></a>true</strong> if the operation is successful; returns <strong id="b209401657153411"><a name="b209401657153411"></a><a name="b209401657153411"></a>false</strong> otherwise.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Return value
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
- Example
```
let predicatesgoNext = new dataRdb.RdbPredicates("EMPLOYEE")
let promisequerygoNext = rdbStore.query(predicatesgoNext, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promisequerygoNext.then((resultSet) {
resultSet.goToNextRow()
resultSet.close()
resultSet = null;
})
```
}).catch((err) => {
console.log('query failed')
})
```
### goToPreviousRow<a name="section12293161972016"></a>
### goToPreviousRow
goToPreviousRow\(\): boolean
goToPreviousRow(): boolean
Moves the cursor to the previous row in the result set.
- Return values
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
<a name="table0760161855311"></a>
<table><thead align="left"><tr id="row1076121845318"><th class="cellrowborder" valign="top" width="17.01%" id="mcps1.1.3.1.1"><p id="p076111187531"><a name="p076111187531"></a><a name="p076111187531"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="82.99%" id="mcps1.1.3.1.2"><p id="p127611180532"><a name="p127611180532"></a><a name="p127611180532"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row117611187532"><td class="cellrowborder" valign="top" width="17.01%" headers="mcps1.1.3.1.1 "><p id="p1954894412136"><a name="p1954894412136"></a><a name="p1954894412136"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="82.99%" headers="mcps1.1.3.1.2 "><p id="p893394712136"><a name="p893394712136"></a><a name="p893394712136"></a>Returns <strong id="b2942857113414"><a name="b2942857113414"></a><a name="b2942857113414"></a>true</strong> if the operation is successful; returns <strong id="b2942257113415"><a name="b2942257113415"></a><a name="b2942257113415"></a>false</strong> otherwise.</p>
</td>
</tr>
</tbody>
</table>
- Return value
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
- Example
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.goToPreviousRow();
resultSet.close();
resultSet = null
})
```
- Example
```
let predicatesgoPrev = new dataRdb.RdbPredicates("EMPLOYEE")
let promisequerygoPrev = rdbStore.query(predicatesgoPrev, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promisequerygoPrev.then((resultSet) {
resultSet.goToPreviousRow()
resultSet.close()
}).catch((err) => {
console.log('query failed')
})
```
### getBlob<a name="section18984643152118"></a>
### getBlob
getBlob\(columnIndex: number\): Uint8Array
getBlob(columnIndex: number): Uint8Array
Obtains the value in the specified column in the current row as a byte array.
- Parameters
<a name="table5897205885518"></a>
<table><thead align="left"><tr id="row18971558165517"><th class="cellrowborder" valign="top" width="14.451487079473427%" id="mcps1.1.5.1.1"><p id="p7898165810553"><a name="p7898165810553"></a><a name="p7898165810553"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="18.95660653339834%" id="mcps1.1.5.1.2"><p id="p11898175812552"><a name="p11898175812552"></a><a name="p11898175812552"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="6.825938566552901%" id="mcps1.1.5.1.3"><p id="p2898115818556"><a name="p2898115818556"></a><a name="p2898115818556"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="59.76596782057533%" id="mcps1.1.5.1.4"><p id="p2089835825511"><a name="p2089835825511"></a><a name="p2089835825511"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row5898558135514"><td class="cellrowborder" valign="top" width="14.451487079473427%" headers="mcps1.1.5.1.1 "><p id="p168981658105519"><a name="p168981658105519"></a><a name="p168981658105519"></a>columnIndex</p>
</td>
<td class="cellrowborder" valign="top" width="18.95660653339834%" headers="mcps1.1.5.1.2 "><p id="p63621801571"><a name="p63621801571"></a><a name="p63621801571"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="6.825938566552901%" headers="mcps1.1.5.1.3 "><p id="p7899358115516"><a name="p7899358115516"></a><a name="p7899358115516"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="59.76596782057533%" headers="mcps1.1.5.1.4 "><p id="p128999581556"><a name="p128999581556"></a><a name="p128999581556"></a>Index of the specified column, starting from 0.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table154018346168"></a>
<table><thead align="left"><tr id="row155411634181610"><th class="cellrowborder" valign="top" width="17.01%" id="mcps1.1.3.1.1"><p id="p254183491612"><a name="p254183491612"></a><a name="p254183491612"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="82.99%" id="mcps1.1.3.1.2"><p id="p3541113415163"><a name="p3541113415163"></a><a name="p3541113415163"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1454193410163"><td class="cellrowborder" valign="top" width="17.01%" headers="mcps1.1.3.1.1 "><p id="p554118342165"><a name="p554118342165"></a><a name="p554118342165"></a>Uint8Array</p>
</td>
<td class="cellrowborder" valign="top" width="82.99%" headers="mcps1.1.3.1.2 "><p id="p155414347169"><a name="p155414347169"></a><a name="p155414347169"></a>Value in the specified column as a byte array.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
const codes = resultSet.getBlob(resultSet.getColumnIndex("CODES"))
```
### getString<a name="section2042914810266"></a>
getString\(columnIndex: number\): string
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
- Return value
| Type| Description|
| -------- | -------- |
| Uint8Array | Value in the specified column as a byte array.|
- Example
```
const codes = resultSet.getBlob(resultSet.getColumnIndex("CODES"))
```
### getString
getString(columnIndex: number): string
Obtains the value in the specified column in the current row as a string.
- Parameters
<a name="table18627821182614"></a>
<table><thead align="left"><tr id="row162782182615"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p36278211263"><a name="p36278211263"></a><a name="p36278211263"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1662732192616"><a name="p1662732192616"></a><a name="p1662732192616"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p1362762182616"><a name="p1362762182616"></a><a name="p1362762182616"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p186282218261"><a name="p186282218261"></a><a name="p186282218261"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row1262810215268"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p196284210266"><a name="p196284210266"></a><a name="p196284210266"></a>columnIndex</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p1462802113268"><a name="p1462802113268"></a><a name="p1462802113268"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p1628192192612"><a name="p1628192192612"></a><a name="p1628192192612"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p13257659141819"><a name="p13257659141819"></a><a name="p13257659141819"></a>Index of the specified column, starting from 0.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table5861925510"></a>
<table><thead align="left"><tr id="row8878250115"><th class="cellrowborder" valign="top" width="17.01%" id="mcps1.1.3.1.1"><p id="p20871425718"><a name="p20871425718"></a><a name="p20871425718"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="82.99%" id="mcps1.1.3.1.2"><p id="p1787625112"><a name="p1787625112"></a><a name="p1787625112"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row3878254119"><td class="cellrowborder" valign="top" width="17.01%" headers="mcps1.1.3.1.1 "><p id="p1734183581915"><a name="p1734183581915"></a><a name="p1734183581915"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="82.99%" headers="mcps1.1.3.1.2 "><p id="p3871251119"><a name="p3871251119"></a><a name="p3871251119"></a>Value in the specified column as a string.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
const name = resultSet.getString(resultSet.getColumnIndex("NAME"))
```
### getLong<a name="section270062312014"></a>
getLong\(columnIndex: number\): number
Obtains the value in the specified column in the current row as a **Long**.
- Parameters
<a name="table670242372014"></a>
<table><thead align="left"><tr id="row6703182362015"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p1670322382019"><a name="p1670322382019"></a><a name="p1670322382019"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p1770482311208"><a name="p1770482311208"></a><a name="p1770482311208"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p18704523122013"><a name="p18704523122013"></a><a name="p18704523122013"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p18704123172013"><a name="p18704123172013"></a><a name="p18704123172013"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row970402311204"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p3704182313202"><a name="p3704182313202"></a><a name="p3704182313202"></a>columnIndex</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p3704223172012"><a name="p3704223172012"></a><a name="p3704223172012"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p20704122302013"><a name="p20704122302013"></a><a name="p20704122302013"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p207055233203"><a name="p207055233203"></a><a name="p207055233203"></a>Index of the specified column, starting from 0.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table87051223112014"></a>
<table><thead align="left"><tr id="row1370682362020"><th class="cellrowborder" valign="top" width="17.01%" id="mcps1.1.3.1.1"><p id="p2706142302015"><a name="p2706142302015"></a><a name="p2706142302015"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="82.99%" id="mcps1.1.3.1.2"><p id="p16706112382019"><a name="p16706112382019"></a><a name="p16706112382019"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row16706102310207"><td class="cellrowborder" valign="top" width="17.01%" headers="mcps1.1.3.1.1 "><p id="p127068235203"><a name="p127068235203"></a><a name="p127068235203"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="82.99%" headers="mcps1.1.3.1.2 "><p id="p1870622302018"><a name="p1870622302018"></a><a name="p1870622302018"></a>Value in the specified column as a <strong id="b15869112345117"><a name="b15869112345117"></a><a name="b15869112345117"></a>Long</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"))
```
### getDouble<a name="section3820153618207"></a>
getDouble\(columnIndex: number\): number
Obtains the value in the specified column in the current row as a **double**.
- Parameters
<a name="table12820163616205"></a>
<table><thead align="left"><tr id="row68215367207"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p98211936182014"><a name="p98211936182014"></a><a name="p98211936182014"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p4821336152015"><a name="p4821336152015"></a><a name="p4821336152015"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p182243652017"><a name="p182243652017"></a><a name="p182243652017"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p20822183611203"><a name="p20822183611203"></a><a name="p20822183611203"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row17822436132012"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p10822103662015"><a name="p10822103662015"></a><a name="p10822103662015"></a>columnIndex</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p178221836102020"><a name="p178221836102020"></a><a name="p178221836102020"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p6822336152011"><a name="p6822336152011"></a><a name="p6822336152011"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p582312362202"><a name="p582312362202"></a><a name="p582312362202"></a>Index of the specified column, starting from 0.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table1582316364202"></a>
<table><thead align="left"><tr id="row148249369203"><th class="cellrowborder" valign="top" width="17.01%" id="mcps1.1.3.1.1"><p id="p10824736122011"><a name="p10824736122011"></a><a name="p10824736122011"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="82.99%" id="mcps1.1.3.1.2"><p id="p108241236162015"><a name="p108241236162015"></a><a name="p108241236162015"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row8824436132014"><td class="cellrowborder" valign="top" width="17.01%" headers="mcps1.1.3.1.1 "><p id="p158241836132017"><a name="p158241836132017"></a><a name="p158241836132017"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="82.99%" headers="mcps1.1.3.1.2 "><p id="p982423642015"><a name="p982423642015"></a><a name="p982423642015"></a>Value in the specified column as a <strong id="b1396205911447"><a name="b1396205911447"></a><a name="b1396205911447"></a>double</strong>.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"))
```
### isColumnNull<a name="section167981954112118"></a>
isColumnNull\(columnIndex: number\): boolean
Checks whether the value in the specified column in the current row is **null**.
- Parameters
<a name="table12799254192110"></a>
<table><thead align="left"><tr id="row279915413216"><th class="cellrowborder" valign="top" width="14.82%" id="mcps1.1.5.1.1"><p id="p279975417215"><a name="p279975417215"></a><a name="p279975417215"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="14.729999999999999%" id="mcps1.1.5.1.2"><p id="p18799155413217"><a name="p18799155413217"></a><a name="p18799155413217"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="9.16%" id="mcps1.1.5.1.3"><p id="p18799195410213"><a name="p18799195410213"></a><a name="p18799195410213"></a>Mandatory</p>
</th>
<th class="cellrowborder" valign="top" width="61.29%" id="mcps1.1.5.1.4"><p id="p1580095411211"><a name="p1580095411211"></a><a name="p1580095411211"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row580018543213"><td class="cellrowborder" valign="top" width="14.82%" headers="mcps1.1.5.1.1 "><p id="p48001854162115"><a name="p48001854162115"></a><a name="p48001854162115"></a>columnIndex</p>
</td>
<td class="cellrowborder" valign="top" width="14.729999999999999%" headers="mcps1.1.5.1.2 "><p id="p0800115442114"><a name="p0800115442114"></a><a name="p0800115442114"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="9.16%" headers="mcps1.1.5.1.3 "><p id="p128001954182115"><a name="p128001954182115"></a><a name="p128001954182115"></a>Yes</p>
</td>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p13800115414215"><a name="p13800115414215"></a><a name="p13800115414215"></a>Index of the specified column, starting from 0.</p>
</td>
</tr>
</tbody>
</table>
- Return values
<a name="table18800165402111"></a>
<table><thead align="left"><tr id="row380155452114"><th class="cellrowborder" valign="top" width="17.01%" id="mcps1.1.3.1.1"><p id="p1680115540219"><a name="p1680115540219"></a><a name="p1680115540219"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="82.99%" id="mcps1.1.3.1.2"><p id="p1801165412113"><a name="p1801165412113"></a><a name="p1801165412113"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row6802165442111"><td class="cellrowborder" valign="top" width="17.01%" headers="mcps1.1.3.1.1 "><p id="p10802115416214"><a name="p10802115416214"></a><a name="p10802115416214"></a>boolean</p>
</td>
<td class="cellrowborder" valign="top" width="82.99%" headers="mcps1.1.3.1.2 "><p id="p16802754172116"><a name="p16802754172116"></a><a name="p16802754172116"></a>Returns <strong id="b3173740204516"><a name="b3173740204516"></a><a name="b3173740204516"></a>true</strong> if the value is null; returns <strong id="b8900151614466"><a name="b8900151614466"></a><a name="b8900151614466"></a>false</strong> otherwise.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
const isColumnNull = resultSet.isColumnNull(resultSet.getColumnIndex("CODES"))
```
### close<a name="section675093133215"></a>
close\(\): void
Closes the result set.
- Example
```
let predicates = new dataRdb.RdbPredicates("EMPLOYEE")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]).then((resultSet) => {
resultSet.close();
resultSet = null
})
```
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
- Return value
| Type| Description|
| -------- | -------- |
| string | Value in the specified column as a string.|
- Example
```
const name = resultSet.getString(resultSet.getColumnIndex("NAME"))
```
### getLong
getLong(columnIndex: number): number
Obtains the value in the specified column in the current row as a Long.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
- Return value
| Type| Description|
| -------- | -------- |
| number | Value in the specified column as a Long.|
- Example
```
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"))
```
### getDouble
getDouble(columnIndex: number): number
Obtains the value in the specified column in the current row as a double.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
- Return value
| Type| Description|
| -------- | -------- |
| number | Value in the specified column as a double.|
- Example
```
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"))
```
### isColumnNull
isColumnNull(columnIndex: number): boolean
Checks whether the value in the specified column of the current row is null.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| columnIndex | number | Yes| Index of the specified column, starting from 0.|
- Return value
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the value is null; returns **false** otherwise.|
- Example
```
const isColumnNull = resultSet.isColumnNull(resultSet.getColumnIndex("CODES"))
```
### close
close(): void
Closes this result set.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
- Example
```
let predicatesclose = new dataRdb.RdbPredicates("EMPLOYEE")
let predicatesclose = rdbStore.query(predicatesclose, ["ID", "NAME", "AGE", "SALARY", "CODES"])
promisequerygoPrev.then((resultSet) {
resultSet.close()
}).catch((err) => {
console.log('query failed')
})
```
......@@ -4,7 +4,10 @@ Lightweight storage provides applications with data processing capability and al
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. <br/>The APIs of this module are no longer maintained since API Version 9. You are advised to use [@ohos.data.preferences](js-apis-data-preferences.md).
>
> - The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs of this module are no longer maintained since API Version 9. You are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md).
## Modules to Import
......@@ -45,12 +48,18 @@ Reads a file and loads the data to the **Storage** instance in synchronous mode.
```
import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext()
var path = await context.getFilesDir()
let storage = dataStorage.getStorageSync(path + '/mystore')
storage.putSync('startup', 'auto')
storage.flushSync()
context.getFilesDir((err, path) => {
if (err) {
console.error('getFilesDir failed. err: ' + JSON.stringify(err));
return;
}
console.info('getFilesDir successful. path:' + JSON.stringify(path));
let storage = dataStorage.getStorageSync(path + '/mystore')
storage.putSync('startup', 'auto')
storage.flushSync()
});
```
......@@ -72,17 +81,23 @@ Reads a file and loads the data to the **Storage** instance. This method uses an
```
import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext()
var path = await context.getFilesDir()
dataStorage.getStorage(path + '/mystore', function (err, storage) {
context.getFilesDir((err, path) => {
if (err) {
console.info("Get the storage failed, path: " + path + '/mystore')
console.error('getFilesDir failed. err: ' + JSON.stringify(err));
return;
}
storage.putSync('startup', 'auto')
storage.flushSync()
})
console.info('getFilesDir successful. path:' + JSON.stringify(path));
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()
})
});
```
......@@ -108,16 +123,22 @@ Reads a file and loads the data to the **Storage** instance. This method uses a
```
import dataStorage from '@ohos.data.storage'
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext()
var path = await context.getFilesDir()
let promisegetSt = dataStorage.getStorage(path + '/mystore')
promisegetSt.then((storage) => {
storage.putSync('startup', 'auto')
storage.flushSync()
}).catch((err) => {
console.info("Get the storage failed, path: " + path + '/mystore')
})
context.getFilesDir((err, path) => {
if (err) {
console.info("Get the storage failed, path: " + path + '/mystore')
return;
}
console.info('getFilesDir successful. path:' + JSON.stringify(path));
let promisegetSt = dataStorage.getStorage(path + '/mystore')
promisegetSt.then((storage) => {
storage.putSync('startup', 'auto')
storage.flushSync()
}).catch((err) => {
console.info("Get the storage failed, path: " + path + '/mystore')
})
});
```
......@@ -250,7 +271,7 @@ removeStorageFromCache(path: string): Promise&lt;void&gt;
Removes the singleton **Storage** instance of a file from the cache. The removed instance cannot be used for data operations. Otherwise, data inconsistency will occur.
This method uses a promise to return the result.
This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
......@@ -426,7 +447,7 @@ put(key: string, value: ValueType): Promise&lt;void&gt;
Obtains the **Storage** instance corresponding to the specified file, writes data to the **Storage** instance using a **Storage** API, and saves the modification using **flush()** or **flushSync()**.
This method uses a promise to return the result.
This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
......@@ -522,7 +543,7 @@ has(key: string): Promise&lt;boolean&gt;
Checks whether the storage object contains data with a given key.
This method uses a promise to return the result.
This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
......@@ -678,7 +699,7 @@ flush(): Promise&lt;void&gt;
Saves the modification of this object to the **Storage** instance and synchronizes the modification to the file.
This method uses a promise to return the result.
This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
......@@ -747,7 +768,7 @@ clear(): Promise&lt;void&gt;
Clears this **Storage** object.
This method uses a promise to return the result.
This method uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册