• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# oh_cursor.h
2
3## Overview
4
5Provides APIs to access the result set obtained by querying the RDB store. A result set is a set of results returned by **query()**.
6
7**File to include**: <database/rdb/oh_cursor.h>
8
9**Library**: libnative_rdb_ndk.z.so
10
11**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
12
13**Since**: 10
14
15**Related module**: [RDB](capi-rdb.md)
16
17## Summary
18
19### Structs
20
21| Name                          | typedef Keyword| Description                                                        |
22| ------------------------------ | ------------- | ------------------------------------------------------------ |
23| [OH_Cursor](capi-rdb-oh-cursor.md) | OH_Cursor     | Provides APIs to access the result set obtained by querying the RDB store. A result set is a set of results returned by **query()**.|
24
25### Functions
26
27| Name                                                        | Description                                      |
28| ------------------------------------------------------------ | ------------------------------------------ |
29| [int OH_Cursor_GetFloatVectorCount(OH_Cursor *cursor, int32_t columnIndex, size_t *length)](#oh_cursor_getfloatvectorcount) | Obtains the length of a floating-point array in the specified column of the current row.      |
30| [int OH_Cursor_GetFloatVector(OH_Cursor *cursor, int32_t columnIndex, float *val, size_t inLen, size_t *outLen)](#oh_cursor_getfloatvector) | Obtains the value in the specified column of the current row in the form of a floating-point array.|
31
32## Function Description
33
34### OH_Cursor_GetFloatVectorCount()
35
36```
37int OH_Cursor_GetFloatVectorCount(OH_Cursor *cursor, int32_t columnIndex, size_t *length)
38```
39
40**Description**
41
42Obtains the length of a floating-point array in the specified column of the current row.
43
44**Since**: 18
45
46
47**Parameters**
48
49| Parameter                                | Description                                                        |
50| -------------------------------------- | ------------------------------------------------------------ |
51| [OH_Cursor](capi-rdb-oh-cursor.md) *cursor | Pointer to the [OH_Cursor](capi-rdb-oh-cursor.md) instance.          |
52| int32_t columnIndex                    | Index of the column, which starts from **0**.                   |
53| size_t *length                         | Pointer to the length of the float array obtained.|
54
55**Returns**
56
57| Type| Description                                                        |
58| ---- | ------------------------------------------------------------ |
59| int  | Returns an execution result.<br>**RDB_OK** indicates that the operation is successful.<br>**RDB_E_ERROR** indicates a common database error.<br>**RDB_E_INVALID_ARGS** indicates that invalid parameters are specified.<br>**RDB_E_SQLITE_CORRUPT** indicates that the database is corrupted.<br>**RDB_E_STEP_RESULT_CLOSED** indicates the result set is closed.<br>**RDB_E_ALREADY_CLOSED** indicates that the database is already closed.<br>**RDB_E_SQLITE_PERM** indicates an SQLite error: access denied.<br>**RDB_E_SQLITE_BUSY** indicates an SQLite error: database file locked.<br>**RDB_E_SQLITE_LOCKED** indicates an SQLite error: database table locked.<br>**RDB_E_SQLITE_NOMEM** indicates an SQLite: insufficient database memory.<br>**RDB_E_SQLITE_IOERR** indicates an SQLite: disk I/O error.<br>**RDB_E_SQLITE_TOO_BIG** indicates an SQLite error: TEXT or BLOB exceeds the limit.<br>**RDB_E_SQLITE_MISMATCH** indicates an SQLite error: data types mismatch. |
60
61### OH_Cursor_GetFloatVector()
62
63```
64int OH_Cursor_GetFloatVector(OH_Cursor *cursor, int32_t columnIndex, float *val, size_t inLen, size_t *outLen)
65```
66
67**Description**
68
69Obtains the value in the specified column of the current row in the form of a floating-point array.
70
71**Since**: 18
72
73
74**Parameters**
75
76| Parameter                                | Description                                                        |
77| -------------------------------------- | ------------------------------------------------------------ |
78| [OH_Cursor](capi-rdb-oh-cursor.md) *cursor | Pointer to the [OH_Cursor](capi-rdb-oh-cursor.md) instance.          |
79| int32_t columnIndex                    | Index of the column, which starts from **0**.                   |
80| float *val                             | Ponter to the value obtained, in a float array. The caller needs to apply for the memory.|
81| size_t inLen                           | Length of the float array requested.                                  |
82| size_t *outLen                         | Pointer to the actual length of the float array.                |
83
84**Returns**
85
86| Type| Description                                                        |
87| ---- | ------------------------------------------------------------ |
88| int  | Returns an execution result.<br>**RDB_OK** indicates that the operation is successful.<br>**RDB_E_ERROR** indicates a common database error.<br>**RDB_E_INVALID_ARGS** indicates that invalid parameters are specified.<br>**RDB_E_SQLITE_CORRUPT** indicates that the database is corrupted.<br>**RDB_E_STEP_RESULT_CLOSED** indicates the result set is closed.<br>**RDB_E_ALREADY_CLOSED** indicates that the database is already closed.<br>**RDB_E_SQLITE_PERM** indicates an SQLite error: access denied.<br>**RDB_E_SQLITE_BUSY** indicates an SQLite error: database file locked.<br>**RDB_E_SQLITE_LOCKED** indicates an SQLite error: database table locked.<br>**RDB_E_SQLITE_NOMEM** indicates an SQLite: insufficient database memory.<br>**RDB_E_SQLITE_IOERR** indicates an SQLite: disk I/O error.<br>**RDB_E_SQLITE_TOO_BIG** indicates an SQLite error: TEXT or BLOB exceeds the limit.<br>**RDB_E_SQLITE_MISMATCH** indicates an SQLite error: data types mismatch. |
89