• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Interface (ResultSet)
2
3> **NOTE**
4>
5> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
6
7Provides APIs to access the result set obtained by querying the RDB store. returned by **query()**.
8
9For the following APIs, you should use either [query](arkts-apis-data-relationalStore-RdbStore.md#query), [querySql](arkts-apis-data-relationalStore-RdbStore.md#querysql), [remoteQuery](arkts-apis-data-relationalStore-RdbStore.md#remotequery-1), or [queryLockedRow](arkts-apis-data-relationalStore-RdbStore.md#querylockedrow12) to obtain the **ResultSet** instance first, and then use this instance to call the corresponding method.
10
11## Module to Import
12
13```ts
14import { relationalStore } from '@kit.ArkData';
15```
16
17## Property
18
19**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
20
21| Name        | Type           | Mandatory| Description                            |
22| ------------ | ------------------- | ---- | -------------------------------- |
23| columnNames  | Array<string> | Yes  | Names of all columns in the result set.      |
24| columnCount  | number              | Yes  | Number of columns in the result set.            |
25| rowCount     | number              | Yes  | Number of rows in the result set.            |
26| rowIndex     | number              | Yes  | Index of the current row in the result set.<br>Default value: **-1**. The index position starts from **0**.|
27| isAtFirstRow | boolean             | Yes  | Whether the result set pointer is in the first row (the row index is **0**). The value **true** means the result set pointer is in the first row.|
28| isAtLastRow  | boolean             | Yes  | Whether the result set pointer is in the last row. The value **true** means the pointer is in the last row.|
29| isEnded      | boolean             | Yes  | Whether the result set pointer is after the last row. The value **true** means the pointer is after the last row.|
30| isStarted    | boolean             | Yes  | Whether the result set pointer is moved. The value **true** means the pointer is moved.            |
31| isClosed     | boolean             | Yes  | Whether the result set is closed. The value **true** means the result set is closed.        |
32
33## getColumnIndex
34
35getColumnIndex(columnName: string): number
36
37Obtains the column index based on the column name.
38
39**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
40
41**Parameters**
42
43| Name    | Type  | Mandatory| Description                      |
44| ---------- | ------ | ---- | -------------------------- |
45| columnName | string | Yes  | Column name.|
46
47**Returns**:
48
49| Type  | Description              |
50| ------ | ------------------ |
51| number | Column index obtained.|
52
53**Error codes**
54
55For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
56
57| **ID**| **Error Message**                                                |
58|-----------| ------------------------------------------------------------ |
59| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
60| 14800000  | Inner error. |
61| 14800011  | Failed to open the database because it is corrupted. |
62| 14800013  | Resultset is empty or column index is out of bounds. |
63| 14800014  | The RdbStore or ResultSet is already closed. |
64| 14800019  | The SQL must be a query statement. |
65| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
66| 14800022  | SQLite: Callback routine requested an abort. |
67| 14800023  | SQLite: Access permission denied. |
68| 14800024  | SQLite: The database file is locked. |
69| 14800025  | SQLite: A table in the database is locked. |
70| 14800026  | SQLite: The database is out of memory. |
71| 14800027  | SQLite: Attempt to write a readonly database. |
72| 14800028  | SQLite: Some kind of disk I/O error occurred. |
73| 14800029  | SQLite: The database is full. |
74| 14800030  | SQLite: Unable to open the database file. |
75| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
76| 14800032  | SQLite: Abort due to constraint violation. |
77| 14800033  | SQLite: Data type mismatch. |
78| 14800034  | SQLite: Library used incorrectly. |
79
80**Example**:
81
82```ts
83if (resultSet != undefined) {
84  const id = (resultSet as relationalStore.ResultSet).getLong((resultSet as relationalStore.ResultSet).getColumnIndex("ID"));
85  const name = (resultSet as relationalStore.ResultSet).getString((resultSet as relationalStore.ResultSet).getColumnIndex("NAME"));
86  const age = (resultSet as relationalStore.ResultSet).getLong((resultSet as relationalStore.ResultSet).getColumnIndex("AGE"));
87  const salary = (resultSet as relationalStore.ResultSet).getDouble((resultSet as relationalStore.ResultSet).getColumnIndex("SALARY"));
88}
89```
90
91## getColumnName
92
93getColumnName(columnIndex: number): string
94
95Obtains the column name based on the column index.
96
97**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
98
99**Parameters**
100
101| Name     | Type  | Mandatory| Description                      |
102| ----------- | ------ | ---- | -------------------------- |
103| columnIndex | number | Yes  | Column index.|
104
105**Returns**:
106
107| Type  | Description              |
108| ------ | ------------------ |
109| string | Column name obtained.|
110
111**Error codes**
112
113For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
114
115| **ID**| **Error Message**                                                |
116|-----------| ------------------------------------------------------------ |
117| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
118| 14800000  | Inner error. |
119| 14800011  | Failed to open the database because it is corrupted. |
120| 14800013  | Resultset is empty or column index is out of bounds. |
121| 14800014  | The RdbStore or ResultSet is already closed. |
122| 14800019  | The SQL must be a query statement. |
123| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
124| 14800022  | SQLite: Callback routine requested an abort. |
125| 14800023  | SQLite: Access permission denied. |
126| 14800024  | SQLite: The database file is locked. |
127| 14800025  | SQLite: A table in the database is locked. |
128| 14800026  | SQLite: The database is out of memory. |
129| 14800027  | SQLite: Attempt to write a readonly database. |
130| 14800028  | SQLite: Some kind of disk I/O error occurred. |
131| 14800029  | SQLite: The database is full. |
132| 14800030  | SQLite: Unable to open the database file. |
133| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
134| 14800032  | SQLite: Abort due to constraint violation. |
135| 14800033  | SQLite: Data type mismatch. |
136| 14800034  | SQLite: Library used incorrectly. |
137
138**Example**:
139
140```ts
141if (resultSet != undefined) {
142  const id = (resultSet as relationalStore.ResultSet).getColumnName(0);
143  const name = (resultSet as relationalStore.ResultSet).getColumnName(1);
144  const age = (resultSet as relationalStore.ResultSet).getColumnName(2);
145}
146```
147
148## getColumnType<sup>18+</sup>
149
150getColumnType(columnIdentifier: number | string): Promise\<ColumnType>
151
152Obtains the column data type based on the specified column index or column name. This API uses a promise to return the result.
153
154**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
155
156**Parameters**
157
158| Name          | Type            | Mandatory| Description                                                        |
159| ---------------- | ---------------- | ---- | ------------------------------------------------------------ |
160| columnIdentifier | number \| string | Yes  | Index or name of column in a result set. The index must be a non-negative integer and cannot exceed the length of **columnNames**. The column name must be a name in **columnNames**.|
161
162**Returns**:
163
164| Type                                | Description                               |
165| ------------------------------------ | ----------------------------------- |
166| Promise<[ColumnType](arkts-apis-data-relationalStore-e.md#columntype18)> | Promise used to return the column type obtained.|
167
168**Error codes**
169
170For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
171
172| **ID**| **Error Message**                                                |
173| ------------ | ------------------------------------------------------------ |
174| 401          | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
175| 14800000     | Inner error.                                                 |
176| 14800011     | Failed to open the database because it is corrupted. |
177| 14800012     | ResultSet is empty or pointer index is out of bounds.                                           |
178| 14800013     | Resultset is empty or column index is out of bounds.                                        |
179| 14800014     | The RdbStore or ResultSet is already closed.                                              |
180| 14800019     | The SQL must be a query statement.                           |
181| 14800021     | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist.                                     |
182| 14800022     | SQLite: Callback routine requested an abort.                 |
183| 14800023     | SQLite: Access permission denied.                            |
184| 14800024     | SQLite: The database file is locked.                         |
185| 14800025     | SQLite: A table in the database is locked.                   |
186| 14800026     | SQLite: The database is out of memory.                       |
187| 14800027     | SQLite: Attempt to write a readonly database.                |
188| 14800028     | SQLite: Some kind of disk I/O error occurred.                |
189| 14800029     | SQLite: The database is full.                                |
190| 14800030     | SQLite: Unable to open the database file.                    |
191| 14800031     | SQLite: TEXT or BLOB exceeds size limit.                     |
192| 14800032     | SQLite: Abort due to constraint violation.                   |
193| 14800033     | SQLite: Data type mismatch.                                  |
194| 14800034     | SQLite: Library used incorrectly.                            |
195
196**Example**:
197
198```ts
199if (resultSet != undefined) {
200  let idType = await (resultSet as relationalStore.ResultSet).getColumnType("ID") as relationalStore.ColumnType;
201  let nameType = await (resultSet as relationalStore.ResultSet).getColumnType("NAME") as relationalStore.ColumnType;
202  let ageType = await (resultSet as relationalStore.ResultSet).getColumnType("AGE") as relationalStore.ColumnType;
203  let salaryType = await (resultSet as relationalStore.ResultSet).getColumnType("SALARY") as relationalStore.ColumnType;
204  let codesType = await (resultSet as relationalStore.ResultSet).getColumnType("CODES") as relationalStore.ColumnType;
205  let identityType = await (resultSet as relationalStore.ResultSet).getColumnType(5) as relationalStore.ColumnType;
206  let assetDataType = await (resultSet as relationalStore.ResultSet).getColumnType(6) as relationalStore.ColumnType;
207  let assetsDataType = await (resultSet as relationalStore.ResultSet).getColumnType(7) as relationalStore.ColumnType;
208  let floatArrayType = await (resultSet as relationalStore.ResultSet).getColumnType(8) as relationalStore.ColumnType;
209}
210```
211
212## getColumnTypeSync<sup>18+</sup>
213
214getColumnTypeSync(columnIdentifier: number | string): ColumnType
215
216Obtains the column data type based on the specified column index or column name. This API returns the result synchronously.
217
218**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
219
220**Parameters**
221
222| Name          | Type            | Mandatory| Description                                                        |
223| ---------------- | ---------------- | ---- | ------------------------------------------------------------ |
224| columnIdentifier | number \| string | Yes  | Index or name of column in a result set. The index must be a non-negative integer and cannot exceed the length of **columnNames**. The column name must be a name in **columnNames**.|
225
226**Returns**:
227
228| Type                       | Description                  |
229| --------------------------- | ---------------------- |
230| [ColumnType](arkts-apis-data-relationalStore-e.md#columntype18) | Column type obtained.|
231
232**Error codes**
233
234For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
235
236| **ID**| **Error Message**                                                |
237| ------------ | ------------------------------------------------------------ |
238| 401          | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
239| 14800000     | Inner error.                                                 |
240| 14800011     | Failed to open the database because it is corrupted. |
241| 14800012     | ResultSet is empty or pointer index is out of bounds.                                           |
242| 14800013     | Resultset is empty or column index is out of bounds.                                        |
243| 14800014     | The RdbStore or ResultSet is already closed.                                              |
244| 14800019     | The SQL must be a query statement.                           |
245| 14800021     | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist.                                     |
246| 14800022     | SQLite: Callback routine requested an abort.                 |
247| 14800023     | SQLite: Access permission denied.                            |
248| 14800024     | SQLite: The database file is locked.                         |
249| 14800025     | SQLite: A table in the database is locked.                   |
250| 14800026     | SQLite: The database is out of memory.                       |
251| 14800027     | SQLite: Attempt to write a readonly database.                |
252| 14800028     | SQLite: Some kind of disk I/O error occurred.                |
253| 14800029     | SQLite: The database is full.                                |
254| 14800030     | SQLite: Unable to open the database file.                    |
255| 14800031     | SQLite: TEXT or BLOB exceeds size limit.                     |
256| 14800032     | SQLite: Abort due to constraint violation.                   |
257| 14800033     | SQLite: Data type mismatch.                                  |
258| 14800034     | SQLite: Library used incorrectly.                            |
259
260**Example**:
261
262```ts
263if (resultSet != undefined) {
264  let idType = (resultSet as relationalStore.ResultSet).getColumnTypeSync("ID") as relationalStore.ColumnType;
265  let nameType = (resultSet as relationalStore.ResultSet).getColumnTypeSync("NAME") as relationalStore.ColumnType;
266  let ageType = (resultSet as relationalStore.ResultSet).getColumnTypeSync("AGE") as relationalStore.ColumnType;
267  let salaryType = (resultSet as relationalStore.ResultSet).getColumnTypeSync("SALARY") as relationalStore.ColumnType;
268  let codesType = (resultSet as relationalStore.ResultSet).getColumnTypeSync("CODES") as relationalStore.ColumnType;
269  let identityType = (resultSet as relationalStore.ResultSet).getColumnTypeSync(5) as relationalStore.ColumnType;
270  let assetDataType = (resultSet as relationalStore.ResultSet).getColumnTypeSync(6) as relationalStore.ColumnType;
271  let assetsDataType = (resultSet as relationalStore.ResultSet).getColumnTypeSync(7) as relationalStore.ColumnType;
272  let floatArrayType = (resultSet as relationalStore.ResultSet).getColumnTypeSync(8) as relationalStore.ColumnType;
273}
274```
275
276## goTo
277
278goTo(offset:number): boolean
279
280Moves the result set pointer based on the offset specified.
281
282**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
283
284**Parameters**
285
286| Name| Type  | Mandatory| Description                        |
287| ------ | ------ | ---- | ---------------------------- |
288| offset | number | Yes  | Offset relative to the position of the current result set pointer. A positive value means to move the pointer backward, and a negative value means to move the pointer forward.|
289
290**Returns**:
291
292| Type   | Description                                         |
293| ------- | --------------------------------------------- |
294| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
295
296**Error codes**
297
298For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
299
300| **ID**| **Error Message**                                                |
301|-----------| ------------------------------------------------------------ |
302| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
303| 14800000  | Inner error. |
304| 14800011  | Failed to open the database because it is corrupted. |
305| 14800012  | ResultSet is empty or pointer index is out of bounds. |
306| 14800014  | The RdbStore or ResultSet is already closed. |
307| 14800019  | The SQL must be a query statement. |
308| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
309| 14800022  | SQLite: Callback routine requested an abort. |
310| 14800023  | SQLite: Access permission denied. |
311| 14800024  | SQLite: The database file is locked. |
312| 14800025  | SQLite: A table in the database is locked. |
313| 14800026  | SQLite: The database is out of memory. |
314| 14800027  | SQLite: Attempt to write a readonly database. |
315| 14800028  | SQLite: Some kind of disk I/O error occurred. |
316| 14800029  | SQLite: The database is full. |
317| 14800030  | SQLite: Unable to open the database file. |
318| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
319| 14800032  | SQLite: Abort due to constraint violation. |
320| 14800033  | SQLite: Data type mismatch. |
321| 14800034  | SQLite: Library used incorrectly. |
322
323**Example**:
324
325```ts
326if (resultSet != undefined) {
327  (resultSet as relationalStore.ResultSet).goTo(1);
328}
329```
330
331## goToRow
332
333goToRow(position: number): boolean
334
335Moves to the specified row in the result set.
336
337**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
338
339**Parameters**
340
341| Name  | Type  | Mandatory| Description                    |
342| -------- | ------ | ---- | ------------------------ |
343| position | number | Yes  | Destination position to move to.|
344
345**Returns**:
346
347| Type   | Description                                         |
348| ------- | --------------------------------------------- |
349| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
350
351**Error codes**
352
353For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
354
355| **ID**| **Error Message**                                                |
356|-----------| ------------------------------------------------------------ |
357| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
358| 14800000  | Inner error. |
359| 14800011  | Failed to open the database because it is corrupted. |
360| 14800012  | ResultSet is empty or pointer index is out of bounds. |
361| 14800014  | The RdbStore or ResultSet is already closed. |
362| 14800019  | The SQL must be a query statement. |
363| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
364| 14800022  | SQLite: Callback routine requested an abort. |
365| 14800023  | SQLite: Access permission denied. |
366| 14800024  | SQLite: The database file is locked. |
367| 14800025  | SQLite: A table in the database is locked. |
368| 14800026  | SQLite: The database is out of memory. |
369| 14800027  | SQLite: Attempt to write a readonly database. |
370| 14800028  | SQLite: Some kind of disk I/O error occurred. |
371| 14800029  | SQLite: The database is full. |
372| 14800030  | SQLite: Unable to open the database file. |
373| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
374| 14800032  | SQLite: Abort due to constraint violation. |
375| 14800033  | SQLite: Data type mismatch. |
376| 14800034  | SQLite: Library used incorrectly. |
377
378**Example**:
379
380```ts
381if (resultSet != undefined) {
382  (resultSet as relationalStore.ResultSet).goToRow(5);
383}
384```
385
386## goToFirstRow
387
388goToFirstRow(): boolean
389
390
391Moves to the first row of the result set.
392
393**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
394
395**Returns**:
396
397| Type   | Description                                         |
398| ------- | --------------------------------------------- |
399| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
400
401**Error codes**
402
403For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
404
405| **ID**| **Error Message**                                                |
406|-----------| ------------------------------------------------------------ |
407| 14800000  | Inner error. |
408| 14800011  | Failed to open the database because it is corrupted. |
409| 14800012  | ResultSet is empty or pointer index is out of bounds. |
410| 14800014  | The RdbStore or ResultSet is already closed. |
411| 14800019  | The SQL must be a query statement. |
412| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
413| 14800022  | SQLite: Callback routine requested an abort. |
414| 14800023  | SQLite: Access permission denied. |
415| 14800024  | SQLite: The database file is locked. |
416| 14800025  | SQLite: A table in the database is locked. |
417| 14800026  | SQLite: The database is out of memory. |
418| 14800027  | SQLite: Attempt to write a readonly database. |
419| 14800028  | SQLite: Some kind of disk I/O error occurred. |
420| 14800029  | SQLite: The database is full. |
421| 14800030  | SQLite: Unable to open the database file. |
422| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
423| 14800032  | SQLite: Abort due to constraint violation. |
424| 14800033  | SQLite: Data type mismatch. |
425| 14800034  | SQLite: Library used incorrectly. |
426
427**Example**:
428
429```ts
430if (resultSet != undefined) {
431  (resultSet as relationalStore.ResultSet).goToFirstRow();
432}
433```
434
435## goToLastRow
436
437goToLastRow(): boolean
438
439Moves to the last row of the result set.
440
441**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
442
443**Returns**:
444
445| Type   | Description                                         |
446| ------- | --------------------------------------------- |
447| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
448
449**Error codes**
450
451For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
452
453| **ID**| **Error Message**                                                |
454|-----------| ------------------------------------------------------------ |
455| 14800000  | Inner error. |
456| 14800011  | Failed to open the database because it is corrupted. |
457| 14800012  | ResultSet is empty or pointer index is out of bounds. |
458| 14800014  | The RdbStore or ResultSet is already closed. |
459| 14800019  | The SQL must be a query statement. |
460| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
461| 14800022  | SQLite: Callback routine requested an abort. |
462| 14800023  | SQLite: Access permission denied. |
463| 14800024  | SQLite: The database file is locked. |
464| 14800025  | SQLite: A table in the database is locked. |
465| 14800026  | SQLite: The database is out of memory. |
466| 14800027  | SQLite: Attempt to write a readonly database. |
467| 14800028  | SQLite: Some kind of disk I/O error occurred. |
468| 14800029  | SQLite: The database is full. |
469| 14800030  | SQLite: Unable to open the database file. |
470| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
471| 14800032  | SQLite: Abort due to constraint violation. |
472| 14800033  | SQLite: Data type mismatch. |
473| 14800034  | SQLite: Library used incorrectly. |
474
475**Example**:
476
477```ts
478if (resultSet != undefined) {
479  (resultSet as relationalStore.ResultSet).goToLastRow();
480}
481```
482
483## goToNextRow
484
485goToNextRow(): boolean
486
487Moves to the next row in the result set.
488
489**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
490
491**Returns**:
492
493| Type   | Description                                         |
494| ------- | --------------------------------------------- |
495| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
496
497**Error codes**
498
499For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
500
501| **ID**| **Error Message**                                                |
502|-----------| ------------------------------------------------------------ |
503| 14800000  | Inner error. |
504| 14800011  | Failed to open the database because it is corrupted. |
505| 14800012  | ResultSet is empty or pointer index is out of bounds. |
506| 14800014  | The RdbStore or ResultSet is already closed. |
507| 14800019  | The SQL must be a query statement. |
508| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
509| 14800022  | SQLite: Callback routine requested an abort. |
510| 14800023  | SQLite: Access permission denied. |
511| 14800024  | SQLite: The database file is locked. |
512| 14800025  | SQLite: A table in the database is locked. |
513| 14800026  | SQLite: The database is out of memory. |
514| 14800027  | SQLite: Attempt to write a readonly database. |
515| 14800028  | SQLite: Some kind of disk I/O error occurred. |
516| 14800029  | SQLite: The database is full. |
517| 14800030  | SQLite: Unable to open the database file. |
518| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
519| 14800032  | SQLite: Abort due to constraint violation. |
520| 14800033  | SQLite: Data type mismatch. |
521| 14800034  | SQLite: Library used incorrectly. |
522
523**Example**:
524
525```ts
526if (resultSet != undefined) {
527  (resultSet as relationalStore.ResultSet).goToNextRow();
528}
529```
530
531## goToPreviousRow
532
533goToPreviousRow(): boolean
534
535Moves to the previous row in the result set.
536
537**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
538
539**Returns**:
540
541| Type   | Description                                         |
542| ------- | --------------------------------------------- |
543| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
544
545**Error codes**
546
547For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
548
549| **ID**| **Error Message**                                                |
550|-----------| ------------------------------------------------------------ |
551| 14800000  | Inner error. |
552| 14800011  | Failed to open the database because it is corrupted. |
553| 14800012  | ResultSet is empty or pointer index is out of bounds. |
554| 14800014  | The RdbStore or ResultSet is already closed. |
555| 14800019  | The SQL must be a query statement. |
556| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
557| 14800022  | SQLite: Callback routine requested an abort. |
558| 14800023  | SQLite: Access permission denied. |
559| 14800024  | SQLite: The database file is locked. |
560| 14800025  | SQLite: A table in the database is locked. |
561| 14800026  | SQLite: The database is out of memory. |
562| 14800027  | SQLite: Attempt to write a readonly database. |
563| 14800028  | SQLite: Some kind of disk I/O error occurred. |
564| 14800029  | SQLite: The database is full. |
565| 14800030  | SQLite: Unable to open the database file. |
566| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
567| 14800032  | SQLite: Abort due to constraint violation. |
568| 14800033  | SQLite: Data type mismatch. |
569| 14800034  | SQLite: Library used incorrectly. |
570
571**Example**:
572
573```ts
574if (resultSet != undefined) {
575  (resultSet as relationalStore.ResultSet).goToPreviousRow();
576}
577```
578
579## getValue<sup>12+</sup>
580
581getValue(columnIndex: number): ValueType
582
583Obtains the value from the specified column and current row. If the value type is any of **ValueType**, the value of the corresponding type will be returned. Otherwise, **14800000** will be returned.
584
585**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
586
587**Parameters**
588
589| Name     | Type  | Mandatory| Description                   |
590| ----------- | ------ | ---- | ----------------------- |
591| columnIndex | number | Yes  | Index of the target column, starting from 0.|
592
593**Returns**:
594
595| Type      | Description                            |
596| ---------- | -------------------------------- |
597| [ValueType](arkts-apis-data-relationalStore-t.md#valuetype) | Allowed data field types.|
598
599**Error codes**
600
601For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
602
603| **ID**| **Error Message**    |
604|-----------|---------|
605| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
606| 14800000  | Inner error.      |
607| 14800011  | Failed to open the database because it is corrupted.        |
608| 14800012  | ResultSet is empty or pointer index is out of bounds.       |
609| 14800013  | Resultset is empty or column index is out of bounds.   |
610| 14800014  | The RdbStore or ResultSet is already closed.       |
611| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist.    |
612| 14800022  | SQLite: Callback routine requested an abort.     |
613| 14800023  | SQLite: Access permission denied.    |
614| 14800024  | SQLite: The database file is locked.    |
615| 14800025  | SQLite: A table in the database is locked.  |
616| 14800026  | SQLite: The database is out of memory.    |
617| 14800027  | SQLite: Attempt to write a readonly database.    |
618| 14800028  | SQLite: Some kind of disk I/O error occurred.    |
619| 14800029  | SQLite: The database is full.   |
620| 14800030  | SQLite: Unable to open the database file.    |
621| 14800031  | SQLite: TEXT or BLOB exceeds size limit.    |
622| 14800032  | SQLite: Abort due to constraint violation.   |
623| 14800033  | SQLite: Data type mismatch.      |
624| 14800034  | SQLite: Library used incorrectly.    |
625
626**Example**:
627
628```ts
629if (resultSet != undefined) {
630  const codes = (resultSet as relationalStore.ResultSet).getValue((resultSet as relationalStore.ResultSet).getColumnIndex("BIGINT_COLUMN"));
631}
632```
633
634## getBlob
635
636getBlob(columnIndex: number): Uint8Array
637
638
639Obtains the value from the specified column and current row, and returns it in a byte array.<br>If the type of the value in the specified column is INTEGER, DOUBLE, TEXT, or BLOB, the value will be converted into a byte array and returned. If the column is empty, an empty byte array will be returned. If the value is of any other type, **14800000** will be returned.
640
641**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
642
643**Parameters**
644
645| Name     | Type  | Mandatory| Description                   |
646| ----------- | ------ | ---- | ----------------------- |
647| columnIndex | number | Yes  | Index of the target column, starting from 0.|
648
649**Returns**:
650
651| Type      | Description                            |
652| ---------- | -------------------------------- |
653| Uint8Array | Value obtained.|
654
655**Error codes**
656
657For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
658
659| **ID**| **Error Message**                                                |
660|-----------| ------------------------------------------------------------ |
661| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
662| 14800000  | Inner error. |
663| 14800011  | Failed to open the database because it is corrupted. |
664| 14800012  | ResultSet is empty or pointer index is out of bounds. |
665| 14800013  | Resultset is empty or column index is out of bounds. |
666| 14800014  | The RdbStore or ResultSet is already closed. |
667| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
668| 14800022  | SQLite: Callback routine requested an abort. |
669| 14800023  | SQLite: Access permission denied. |
670| 14800024  | SQLite: The database file is locked. |
671| 14800025  | SQLite: A table in the database is locked. |
672| 14800026  | SQLite: The database is out of memory. |
673| 14800027  | SQLite: Attempt to write a readonly database. |
674| 14800028  | SQLite: Some kind of disk I/O error occurred. |
675| 14800029  | SQLite: The database is full. |
676| 14800030  | SQLite: Unable to open the database file. |
677| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
678| 14800032  | SQLite: Abort due to constraint violation. |
679| 14800033  | SQLite: Data type mismatch. |
680| 14800034  | SQLite: Library used incorrectly. |
681
682**Example**:
683
684```ts
685if (resultSet != undefined) {
686  const codes = (resultSet as relationalStore.ResultSet).getBlob((resultSet as relationalStore.ResultSet).getColumnIndex("CODES"));
687}
688```
689
690## getString
691
692getString(columnIndex: number): string
693
694Obtains the value from the specified column and current row, and returns it in the form of a string.<br>If the type of the value in the specified column is INTEGER, DOUBLE, TEXT, or BLOB, a string will be returned. If the value type is INTEGER and the column is empty, an empty string will be returned. If the value is of any other type, **14800000** will be returned. If the value in the current column is of the DOUBLE type, the precision may be lost. You are advised to use [getDouble](#getdouble) to obtain the value.
695
696**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
697
698**Parameters**
699
700| Name     | Type  | Mandatory| Description                   |
701| ----------- | ------ | ---- | ----------------------- |
702| columnIndex | number | Yes  | Index of the target column, starting from 0.|
703
704**Returns**:
705
706| Type  | Description                        |
707| ------ | ---------------------------- |
708| string | Value obtained.|
709
710**Error codes**
711
712For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
713
714| **ID**| **Error Message**                                                |
715|-----------| ------------------------------------------------------------ |
716| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
717| 14800000  | Inner error. |
718| 14800011  | Failed to open the database because it is corrupted. |
719| 14800012  | ResultSet is empty or pointer index is out of bounds. |
720| 14800013  | Resultset is empty or column index is out of bounds. |
721| 14800014  | The RdbStore or ResultSet is already closed. |
722| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
723| 14800022  | SQLite: Callback routine requested an abort. |
724| 14800023  | SQLite: Access permission denied. |
725| 14800024  | SQLite: The database file is locked. |
726| 14800025  | SQLite: A table in the database is locked. |
727| 14800026  | SQLite: The database is out of memory. |
728| 14800027  | SQLite: Attempt to write a readonly database. |
729| 14800028  | SQLite: Some kind of disk I/O error occurred. |
730| 14800029  | SQLite: The database is full. |
731| 14800030  | SQLite: Unable to open the database file. |
732| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
733| 14800032  | SQLite: Abort due to constraint violation. |
734| 14800033  | SQLite: Data type mismatch. |
735| 14800034  | SQLite: Library used incorrectly. |
736
737**Example**:
738
739```ts
740if (resultSet != undefined) {
741  const name = (resultSet as relationalStore.ResultSet).getString((resultSet as relationalStore.ResultSet).getColumnIndex("NAME"));
742}
743```
744
745## getLong
746
747getLong(columnIndex: number): number
748
749Obtains the value from the specified column and current row, and returns a value of Long type.<br>If the type of the value in the specified column is INTEGER, DOUBLE, TEXT, or BLOB, a value of Long type will be returned. If the column is empty, **0** will be returned. If the value is of any other type, **14800000** will be returned.
750
751**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
752
753**Parameters**
754
755| Name     | Type  | Mandatory| Description                   |
756| ----------- | ------ | ---- | ----------------------- |
757| columnIndex | number | Yes  | Index of the target column, starting from 0.|
758
759**Returns**:
760
761| Type  | Description                                                        |
762| ------ | ------------------------------------------------------------ |
763| number | Value obtained.<br>The value range supported by this API is **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. If the value is out of this range, use [getDouble](#getdouble).|
764
765**Error codes**
766
767For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
768
769| **ID**| **Error Message**                                                |
770|-----------| ------------------------------------------------------------ |
771| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
772| 14800000  | Inner error. |
773| 14800011  | Failed to open the database because it is corrupted. |
774| 14800012  | ResultSet is empty or pointer index is out of bounds. |
775| 14800013  | Resultset is empty or column index is out of bounds. |
776| 14800014  | The RdbStore or ResultSet is already closed. |
777| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
778| 14800022  | SQLite: Callback routine requested an abort. |
779| 14800023  | SQLite: Access permission denied. |
780| 14800024  | SQLite: The database file is locked. |
781| 14800025  | SQLite: A table in the database is locked. |
782| 14800026  | SQLite: The database is out of memory. |
783| 14800027  | SQLite: Attempt to write a readonly database. |
784| 14800028  | SQLite: Some kind of disk I/O error occurred. |
785| 14800029  | SQLite: The database is full. |
786| 14800030  | SQLite: Unable to open the database file. |
787| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
788| 14800032  | SQLite: Abort due to constraint violation. |
789| 14800033  | SQLite: Data type mismatch. |
790| 14800034  | SQLite: Library used incorrectly. |
791
792**Example**:
793
794```ts
795if (resultSet != undefined) {
796  const age = (resultSet as relationalStore.ResultSet).getLong((resultSet as relationalStore.ResultSet).getColumnIndex("AGE"));
797}
798```
799
800## getDouble
801
802getDouble(columnIndex: number): number
803
804Obtains the value from the specified column and current row, and returns a value of double type.<br>If the type of the value in the specified column is INTEGER, DOUBLE, TEXT, or BLOB, a value of double type will be returned. If the column is empty, **0.0** will be returned. If the value is of any other type, **14800000** will be returned.
805
806**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
807
808**Parameters**
809
810| Name     | Type  | Mandatory| Description                   |
811| ----------- | ------ | ---- | ----------------------- |
812| columnIndex | number | Yes  | Index of the target column, starting from 0.|
813
814**Returns**:
815
816| Type  | Description                        |
817| ------ | ---------------------------- |
818| number | Value obtained.|
819
820**Error codes**
821
822For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
823
824| **ID**| **Error Message**                                                |
825|-----------| ------------------------------------------------------------ |
826| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
827| 14800000  | Inner error. |
828| 14800011  | Failed to open the database because it is corrupted. |
829| 14800012  | ResultSet is empty or pointer index is out of bounds. |
830| 14800013  | Resultset is empty or column index is out of bounds. |
831| 14800014  | The RdbStore or ResultSet is already closed. |
832| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
833| 14800022  | SQLite: Callback routine requested an abort. |
834| 14800023  | SQLite: Access permission denied. |
835| 14800024  | SQLite: The database file is locked. |
836| 14800025  | SQLite: A table in the database is locked. |
837| 14800026  | SQLite: The database is out of memory. |
838| 14800027  | SQLite: Attempt to write a readonly database. |
839| 14800028  | SQLite: Some kind of disk I/O error occurred. |
840| 14800029  | SQLite: The database is full. |
841| 14800030  | SQLite: Unable to open the database file. |
842| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
843| 14800032  | SQLite: Abort due to constraint violation. |
844| 14800033  | SQLite: Data type mismatch. |
845| 14800034  | SQLite: Library used incorrectly. |
846
847**Example**:
848
849```ts
850if (resultSet != undefined) {
851  const salary = (resultSet as relationalStore.ResultSet).getDouble((resultSet as relationalStore.ResultSet).getColumnIndex("SALARY"));
852}
853```
854
855## getAsset<sup>10+</sup>
856
857getAsset(columnIndex: number): Asset
858
859Obtains the value from the specified column and current row, and returns the value in the [Asset](arkts-apis-data-relationalStore-i.md#asset10) format. If the type of the value in the column is **Asset**, the value of the Asset type is returned. If the value in the column is null, **null** is returned. If the value in the column is of other types, **14800000** is returned.
860
861**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
862
863**Parameters**
864
865| Name        | Type    | Mandatory | Description          |
866| ----------- | ------ | --- | ------------ |
867| columnIndex | number | Yes  | Index of the target column, starting from 0.|
868
869**Returns**:
870
871| Type             | Description                        |
872| --------------- | -------------------------- |
873| [Asset](arkts-apis-data-relationalStore-i.md#asset10) | Value obtained.|
874
875**Error codes**
876
877For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
878
879| **ID**| **Error Message**                                                |
880|-----------| ------------------------------------------------------------ |
881| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
882| 14800000  | Inner error. |
883| 14800011  | Failed to open the database because it is corrupted. |
884| 14800012  | ResultSet is empty or pointer index is out of bounds. |
885| 14800013  | Resultset is empty or column index is out of bounds. |
886| 14800014  | The RdbStore or ResultSet is already closed. |
887| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
888| 14800022  | SQLite: Callback routine requested an abort. |
889| 14800023  | SQLite: Access permission denied. |
890| 14800024  | SQLite: The database file is locked. |
891| 14800025  | SQLite: A table in the database is locked. |
892| 14800026  | SQLite: The database is out of memory. |
893| 14800027  | SQLite: Attempt to write a readonly database. |
894| 14800028  | SQLite: Some kind of disk I/O error occurred. |
895| 14800029  | SQLite: The database is full. |
896| 14800030  | SQLite: Unable to open the database file. |
897| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
898| 14800032  | SQLite: Abort due to constraint violation. |
899| 14800033  | SQLite: Data type mismatch. |
900| 14800034  | SQLite: Library used incorrectly. |
901
902**Example**:
903
904```ts
905if (resultSet != undefined) {
906  const doc = (resultSet as relationalStore.ResultSet).getAsset((resultSet as relationalStore.ResultSet).getColumnIndex("DOC"));
907}
908```
909
910## getAssets<sup>10+</sup>
911
912getAssets(columnIndex: number): Assets
913
914Obtains the value from the specified column and current row, and returns the value in the [Assets](arkts-apis-data-relationalStore-t.md#assets10) format. If the type of the value in the column is **Assets**, the value of the Assets type is returned. If the value in the column is null, **null** is returned. If the value in the column is of other types, **14800000** is returned.
915
916**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
917
918**Parameters**
919
920| Name        | Type    | Mandatory | Description          |
921| ----------- | ------ | --- | ------------ |
922| columnIndex | number | Yes  | Index of the target column, starting from 0.|
923
924**Returns**:
925
926| Type             | Description                          |
927| ---------------- | ---------------------------- |
928| [Assets](arkts-apis-data-relationalStore-t.md#assets10)| Value obtained.|
929
930**Error codes**
931
932For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
933
934| **ID**| **Error Message**                                                |
935|-----------| ------------------------------------------------------------ |
936| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
937| 14800000  | Inner error. |
938| 14800011  | Failed to open the database because it is corrupted. |
939| 14800012  | ResultSet is empty or pointer index is out of bounds. |
940| 14800013  | Resultset is empty or column index is out of bounds. |
941| 14800014  | The RdbStore or ResultSet is already closed. |
942| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
943| 14800022  | SQLite: Callback routine requested an abort. |
944| 14800023  | SQLite: Access permission denied. |
945| 14800024  | SQLite: The database file is locked. |
946| 14800025  | SQLite: A table in the database is locked. |
947| 14800026  | SQLite: The database is out of memory. |
948| 14800027  | SQLite: Attempt to write a readonly database. |
949| 14800028  | SQLite: Some kind of disk I/O error occurred. |
950| 14800029  | SQLite: The database is full. |
951| 14800030  | SQLite: Unable to open the database file. |
952| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
953| 14800032  | SQLite: Abort due to constraint violation. |
954| 14800033  | SQLite: Data type mismatch. |
955| 14800034  | SQLite: Library used incorrectly. |
956
957**Example**:
958
959```ts
960if (resultSet != undefined) {
961  const docs = (resultSet as relationalStore.ResultSet).getAssets((resultSet as relationalStore.ResultSet).getColumnIndex("DOCS"));
962}
963```
964
965## getRow<sup>11+</sup>
966
967getRow(): ValuesBucket
968
969Obtains the current row.
970
971**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
972
973**Returns**:
974
975| Type             | Description                          |
976| ---------------- | ---------------------------- |
977| [ValuesBucket](arkts-apis-data-relationalStore-t.md#valuesbucket) | Value of the specified row.|
978
979**Error codes**
980
981For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
982
983| **ID**| **Error Message**                                                |
984|-----------| ------------------------------------------------------------ |
985| 14800000  | Inner error. |
986| 14800011  | Failed to open the database because it is corrupted. |
987| 14800012  | ResultSet is empty or pointer index is out of bounds. |
988| 14800013  | Resultset is empty or column index is out of bounds. |
989| 14800014  | The RdbStore or ResultSet is already closed. |
990| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
991| 14800022  | SQLite: Callback routine requested an abort. |
992| 14800023  | SQLite: Access permission denied. |
993| 14800024  | SQLite: The database file is locked. |
994| 14800025  | SQLite: A table in the database is locked. |
995| 14800026  | SQLite: The database is out of memory. |
996| 14800027  | SQLite: Attempt to write a readonly database. |
997| 14800028  | SQLite: Some kind of disk I/O error occurred. |
998| 14800029  | SQLite: The database is full. |
999| 14800030  | SQLite: Unable to open the database file. |
1000| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
1001| 14800032  | SQLite: Abort due to constraint violation. |
1002| 14800033  | SQLite: Data type mismatch. |
1003| 14800034  | SQLite: Library used incorrectly. |
1004
1005**Example**:
1006
1007```ts
1008if (resultSet != undefined) {
1009  const row = (resultSet as relationalStore.ResultSet).getRow();
1010}
1011```
1012
1013## getRows<sup>18+</sup>
1014
1015getRows(maxCount: number, position?: number): Promise<Array\<ValuesBucket>>
1016
1017Obtains a specified amount of data from the result set. This API uses a promise to return the result. Do not call this API concurrently with other APIs of [ResultSet](arkts-apis-data-relationalStore-ResultSet.md). Otherwise, unexpected data may be obtained.
1018
1019**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
1020
1021**Parameters**
1022
1023| Name     | Type  | Mandatory| Description                   |
1024| ----------- | ------ | ---- | ----------------------- |
1025| maxCount | number | Yes  | Number of rows to obtain. The value is a positive integer. If the value is not a positive integer, error 401 will be thrown.|
1026| position | number | No  | Start position for obtaining data from the result set. The value is a non-negative integer. If this parameter is not specified, data is obtained from the current row of the result set (by default, it is the first row of the result set when data is obtained for the first time). If it is not a non-negative integer, error code 401 will be thrown.|
1027
1028
1029**Returns**:
1030
1031| Type             | Description                          |
1032| ---------------- | ---------------------------- |
1033| Promise<Array<[ValuesBucket](arkts-apis-data-relationalStore-t.md#valuesbucket)>> | Promise used to return **maxCount** rows of data obtained. If the number of remaining records is less than **maxCount**, the remaining records are returned. Returning an empty array indicates that the end of the result set is reached.|
1034
1035**Error codes**
1036
1037For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
1038
1039| **ID**| **Error Message**                                                |
1040|-----------| ------------------------------------------------------------ |
1041| 401  | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1042| 14800000  | Inner error. |
1043| 14800011  | Failed to open the database because it is corrupted. |
1044| 14800012  | ResultSet is empty or pointer index is out of bounds. |
1045| 14800013  | Resultset is empty or column index is out of bounds. |
1046| 14800014  | The RdbStore or ResultSet is already closed. |
1047| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
1048| 14800022  | SQLite: Callback routine requested an abort. |
1049| 14800023  | SQLite: Access permission denied. |
1050| 14800024  | SQLite: The database file is locked. |
1051| 14800025  | SQLite: A table in the database is locked. |
1052| 14800026  | SQLite: The database is out of memory. |
1053| 14800028  | SQLite: Some kind of disk I/O error occurred. |
1054| 14800029  | SQLite: The database is full. |
1055| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
1056| 14800032  | SQLite: Abort due to constraint violation. |
1057| 14800033  | SQLite: Data type mismatch. |
1058
1059**Example**:
1060
1061```ts
1062// Obtain 100 rows of data.
1063async function proccessRows(resultSet: relationalStore.ResultSet) {
1064  // Example 1: Specify only maxCount.
1065  if (resultSet != undefined) {
1066    let rows: Array<relationalStore.ValuesBucket>;
1067    let maxCount: number = 50;
1068    // Obtain data from the current row of the result set. By default, the first fetch starts from the first row of the current result set. Subsequent fetches start from the row following the last row retrieved.
1069    // getRows automatically moves the current row of the result set to the row following the last row retrieved by the previous getRows call. You do not need to use APIs such as goToFirstRow and goToNextRow.
1070    while ((rows = await (resultSet as relationalStore.ResultSet).getRows(maxCount)).length != 0) {
1071      console.info(JSON.stringify(rows[0]));
1072    }
1073  }
1074
1075  // Example 2: Specify maxCount and position.
1076  if (resultSet != undefined) {
1077    let rows: Array<relationalStore.ValuesBucket>;
1078    let maxCount: number = 50;
1079    let position: number = 50;
1080    while ((rows = await (resultSet as relationalStore.ResultSet).getRows(maxCount, position)).length != 0) {
1081      console.info(JSON.stringify(rows[0]));
1082      position += rows.length;
1083    }
1084  }
1085}
1086```
1087
1088## getSendableRow<sup>12+</sup>
1089
1090getSendableRow(): sendableRelationalStore.ValuesBucket
1091
1092Obtains the sendable data from the current row. The sendable data can be passed across threads.
1093
1094**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
1095
1096**Returns**:
1097
1098| Type                                                                                          | Description                                        |
1099| ---------------------------------------------------------------------------------------------- | -------------------------------------------- |
1100| [sendableRelationalStore.ValuesBucket](./js-apis-data-sendableRelationalStore.md#valuesbucket) | Sendable data obtained for cross-thread transfer.|
1101
1102**Error codes**
1103
1104For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
1105
1106| **ID**| **Error Message**                                 |
1107| ------------ | --------------------------------------------- |
1108| 14800000     | Inner error.                                  |
1109| 14800011     | Failed to open the database because it is corrupted.                           |
1110| 14800012     | ResultSet is empty or pointer index is out of bounds.                            |
1111| 14800013     | Resultset is empty or column index is out of bounds.                         |
1112| 14800014     | The RdbStore or ResultSet is already closed.                               |
1113| 14800021     | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist.                        |
1114| 14800022     | SQLite: Callback routine requested an abort.  |
1115| 14800023     | SQLite: Access permission denied.             |
1116| 14800024     | SQLite: The database file is locked.          |
1117| 14800025     | SQLite: A table in the database is locked.    |
1118| 14800026     | SQLite: The database is out of memory.        |
1119| 14800027     | SQLite: Attempt to write a readonly database. |
1120| 14800028     | SQLite: Some kind of disk I/O error occurred. |
1121| 14800029     | SQLite: The database is full.                 |
1122| 14800030     | SQLite: Unable to open the database file.     |
1123| 14800031     | SQLite: TEXT or BLOB exceeds size limit.      |
1124| 14800032     | SQLite: Abort due to constraint violation.    |
1125| 14800033     | SQLite: Data type mismatch.                   |
1126| 14800034     | SQLite: Library used incorrectly.             |
1127
1128**Example**:
1129
1130<!--code_no_check-->
1131```ts
1132import { window } from '@kit.ArkUI';
1133import { UIAbility } from '@kit.AbilityKit';
1134import { relationalStore } from '@kit.ArkData';
1135import { taskpool } from '@kit.ArkTS';
1136import type ctx from '@ohos.app.ability.common';
1137import { sendableRelationalStore } from '@kit.ArkData';
1138
1139@Concurrent
1140async function getDataByName(name: string, context: ctx.UIAbilityContext) {
1141  const STORE_CONFIG: relationalStore.StoreConfig = {
1142    name: "RdbTest.db",
1143    securityLevel: relationalStore.SecurityLevel.S3
1144  };
1145  const store = await relationalStore.getRdbStore(context, STORE_CONFIG);
1146  const predicates = new relationalStore.RdbPredicates("EMPLOYEE");
1147  predicates.equalTo("NAME", name);
1148  const resultSet = store.querySync(predicates);
1149
1150  if (resultSet.rowCount > 0) {
1151    resultSet.goToFirstRow();
1152    const sendableValuesBucket = resultSet.getSendableRow();
1153    return sendableValuesBucket;
1154  } else {
1155    return null;
1156  }
1157}
1158
1159export default class EntryAbility extends UIAbility {
1160  async onWindowStageCreate(windowStage: window.WindowStage) {
1161    const task = new taskpool.Task(getDataByName, 'Lisa', this.context);
1162    const sendableValuesBucket = await taskpool.execute(task) as sendableRelationalStore.ValuesBucket;
1163
1164    if (sendableValuesBucket) {
1165      const columnCount = sendableValuesBucket.size;
1166      const age = sendableValuesBucket.get('age');
1167      const name = sendableValuesBucket.get('name');
1168      console.info(`Query data in taskpool succeeded, name is "${name}", age is "${age}"`);
1169    }
1170  }
1171}
1172```
1173
1174## isColumnNull
1175
1176isColumnNull(columnIndex: number): boolean
1177
1178Checks whether the value in the specified column is null.
1179
1180**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
1181
1182**Parameters**
1183
1184| Name     | Type  | Mandatory| Description                   |
1185| ----------- | ------ | ---- | ----------------------- |
1186| columnIndex | number | Yes  | Index of the target column, starting from 0.|
1187
1188**Returns**:
1189
1190| Type   | Description                                                     |
1191| ------- | --------------------------------------------------------- |
1192| boolean | Returns **true** if the value is null; returns **false** otherwise.|
1193
1194**Error codes**
1195
1196For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
1197
1198| **ID**| **Error Message**                                                |
1199|-----------| ------------------------------------------------------- |
1200| 401       | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. |
1201| 14800000  | Inner error. |
1202| 14800011  | Failed to open the database because it is corrupted. |
1203| 14800012  | ResultSet is empty or pointer index is out of bounds. |
1204| 14800013  | Resultset is empty or column index is out of bounds. |
1205| 14800014  | The RdbStore or ResultSet is already closed. |
1206| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
1207| 14800022  | SQLite: Callback routine requested an abort. |
1208| 14800023  | SQLite: Access permission denied. |
1209| 14800024  | SQLite: The database file is locked. |
1210| 14800025  | SQLite: A table in the database is locked. |
1211| 14800026  | SQLite: The database is out of memory. |
1212| 14800027  | SQLite: Attempt to write a readonly database. |
1213| 14800028  | SQLite: Some kind of disk I/O error occurred. |
1214| 14800029  | SQLite: The database is full. |
1215| 14800030  | SQLite: Unable to open the database file. |
1216| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
1217| 14800032  | SQLite: Abort due to constraint violation. |
1218| 14800033  | SQLite: Data type mismatch. |
1219| 14800034  | SQLite: Library used incorrectly. |
1220
1221**Example**:
1222
1223```ts
1224if (resultSet != undefined) {
1225  const isColumnNull = (resultSet as relationalStore.ResultSet).isColumnNull((resultSet as relationalStore.ResultSet).getColumnIndex("CODES"));
1226}
1227```
1228
1229## getValueForFlutter<sup>20+</sup>
1230
1231getValueForFlutter(columnIndex: number): ValueType
1232
1233Obtains the value from the specified column and current row. If the value is a number and exceeds the value range of **number**, the value is returned as a string.
1234
1235**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
1236
1237**Parameters**
1238
1239| Name     | Type  | Mandatory| Description                   |
1240| ----------- | ------ | ---- | ----------------------- |
1241| columnIndex | number | Yes  | Index of the target column, starting from 0.|
1242
1243**Returns**:
1244
1245| Type      | Description                            |
1246| ---------- | -------------------------------- |
1247| [ValueType](arkts-apis-data-relationalStore-t.md#valuetype) | Value obtained.|
1248
1249**Error codes**
1250
1251For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
1252
1253| **ID**| **Error Message**    |
1254|-----------|---------|
1255| 14800011  | Failed to open the database because it is corrupted.        |
1256| 14800012  | ResultSet is empty or pointer index is out of bounds.       |
1257| 14800013  | Resultset is empty or column index is out of bounds.   |
1258| 14800014  | The RdbStore or ResultSet is already closed.       |
1259| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist.    |
1260| 14800023  | SQLite: Access permission denied.    |
1261| 14800024  | SQLite: The database file is locked.    |
1262| 14800025  | SQLite: A table in the database is locked.  |
1263| 14800028  | SQLite: Some kind of disk I/O error occurred.    |
1264| 14800030  | SQLite: Unable to open the database file.    |
1265| 14800031  | SQLite: TEXT or BLOB exceeds size limit.    |
1266
1267**Example**:
1268
1269```ts
1270if (resultSet != undefined) {
1271  const codes = (resultSet as relationalStore.ResultSet).getValueForFlutter((resultSet as relationalStore.ResultSet).getColumnIndex("BIGINT_COLUMN"));
1272}
1273```
1274
1275## getRowForFlutter<sup>20+</sup>
1276
1277getRowForFlutter(): ValuesBucket
1278
1279Obtains the value from the specified column and all rows. If the value is a number and exceeds the value range of **number**, the value is returned as a string.
1280
1281**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
1282
1283**Returns**:
1284
1285| Type             | Description                          |
1286| ---------------- | ---------------------------- |
1287| [ValuesBucket](arkts-apis-data-relationalStore-t.md#valuesbucket) | Value obtained.|
1288
1289**Error codes**
1290
1291For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). For details about how to handle error 14800011, see [Database Backup and Restore](../../database/data-backup-and-restore.md).
1292
1293| **ID**| **Error Message**                                                |
1294|-----------| ------------------------------------------------------------ |
1295| 14800011  | Failed to open the database because it is corrupted. |
1296| 14800012  | ResultSet is empty or pointer index is out of bounds. |
1297| 14800014  | The RdbStore or ResultSet is already closed. |
1298| 14800021  | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. |
1299| 14800023  | SQLite: Access permission denied. |
1300| 14800024  | SQLite: The database file is locked. |
1301| 14800025  | SQLite: A table in the database is locked. |
1302| 14800028  | SQLite: Some kind of disk I/O error occurred. |
1303| 14800030  | SQLite: Unable to open the database file. |
1304| 14800031  | SQLite: TEXT or BLOB exceeds size limit. |
1305
1306**Example**:
1307
1308```ts
1309if (resultSet != undefined) {
1310  const row = (resultSet as relationalStore.ResultSet).getRowForFlutter();
1311}
1312```
1313
1314## close
1315
1316close(): void
1317
1318Closes this **resultSet** to release memory. If the **resultSet** is not closed, FD or memory leaks may occur.
1319
1320**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
1321
1322**Example**:
1323
1324```ts
1325if (resultSet != undefined) {
1326  (resultSet as relationalStore.ResultSet).close();
1327}
1328```
1329
1330**Error codes**
1331
1332For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md).
1333
1334| **ID**| **Error Message**                                                |
1335|-----------| ------------------------------------------------------------ |
1336| 14800000  | Inner error. |
1337| 14800012  | ResultSet is empty or pointer index is out of bounds. |
1338