• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# RDB
2
3
4## Overview
5
6The relational database (RDB) store manages data based on relational models. The RDB store provides a complete mechanism for managing local databases based on the underlying SQLite. It provides a series of methods for performing operations, such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements to satisfy different needs in complicated scenarios.
7
8**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
9
10**Since**: 10
11
12
13## Summary
14
15
16### Files
17
18| Name| Description|
19| -------- | -------- |
20| [oh_cursor.h](oh__cursor_8h.md) | Provides APIs to access the result set obtained by querying the RDB store.|
21| [oh_predicates.h](oh__predicates_8h.md) | Defines the predicates for RDB stores.|
22| [oh_value_object.h](oh__value__object_8h.md) | Provides type conversion methods.|
23| [oh_values_bucket.h](oh__values__bucket_8h.md) | Defines the types of the key and value in a key-value (KV) pair.|
24| [relational_store.h](relational__store_8h.md) | Provides APIs to manage an RDB store.|
25| [relational_store_error_code.h](relational__store__error__code_8h.md) | Defines the error codes used for RDB stores.|
26
27
28### Structs
29
30| Name| Description|
31| -------- | -------- |
32| [OH_Cursor](_o_h___cursor.md) | Defines a result set.|
33| [OH_Predicates](_o_h___predicates.md) | Defines a **predicates** object.|
34| [OH_VObject](_o_h___v_object.md) | Defines the allowed data field types.|
35| [OH_VBucket](_o_h___v_bucket.md) | Defines the types of the key and value in a KV pair.|
36| [OH_Rdb_Config](_o_h___rdb___config.md) | Defines the RDB store configuration.|
37| [OH_Rdb_Store](_o_h___rdb___store.md) | Defines the RDB store type.|
38| [Rdb_DistributedConfig](_rdb___distributed_config.md) | Defines the distributed configuration of a table.|
39| [Rdb_KeyInfo](_rdb___key_info.md) | Defines the primary key or row number of the row that changes.|
40| [Rdb_KeyInfo::Rdb_KeyData](union_rdb___key_info_1_1_rdb___key_data.md) | Defines the changed data.|
41| [Rdb_ChangeInfo](_rdb___change_info.md) | Defines the details about the device-cloud synchronization process.|
42| [Rdb_Statistic](_rdb___statistic.md) | Defines the device-cloud synchronization statistics of a database table.|
43| [Rdb_TableDetails](_rdb___table_details.md) | Defines the statistics of device-cloud upload and download tasks of a database table. |
44| [Rdb_ProgressDetails](_rdb___progress_details.md) | Defines the statistics of the overall device-cloud synchronization (upload and download) tasks.|
45
46
47### Macros
48
49| Name| Description|
50| -------- | -------- |
51| [DISTRIBUTED_CONFIG_VERSION](#distributed_config_version)   1 | Version of [Rdb_DistributedConfig](_rdb___distributed_config.md).|
52| [DISTRIBUTED_CHANGE_INFO_VERSION](#distributed_change_info_version)   1 | Version of [Rdb_ChangeInfo](_rdb___change_info.md).|
53| [DISTRIBUTED_PROGRESS_DETAIL_VERSION](#distributed_progress_detail_version)   1 | Version of [Rdb_ProgressDetails](_rdb___progress_details.md).|
54
55
56### Types
57
58| Name| Description|
59| -------- | -------- |
60| [OH_ColumnType](#oh_columntype) | Defines an enum for the types of the fields in an RDB store.|
61| [OH_Cursor](#oh_cursor) | Defines a struct for a result set.|
62| [OH_OrderType](#oh_ordertype) | Defines an enum for sorting types.|
63| [OH_Predicates](#oh_predicates) | Defines a **predicates** object.|
64| [OH_VObject](#oh_vobject) | Defines a struct for allowed data field types.|
65| [OH_VBucket](#oh_vbucket) | Defines a struct for the types of the key and value in a KV pair.|
66| [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel) | Defines an enum for RDB store security levels.|
67| [Rdb_SecurityArea](#rdb_securityarea) | Defines an enum for security area levels of an RDB store.|
68| [Rdb_DistributedType](#rdb_distributedtype) | Defines an enum for distributed types.|
69| [Rdb_DistributedConfig](#rdb_distributedconfig) | Defines a struct for distributed configuration of a table.|
70| [Rdb_ChangeType](#rdb_changetype) | Defines an enum for data change types.|
71| [Rdb_KeyInfo](#rdb_keyinfo) | Defines a struct for the primary key or row number of the row that changes.|
72| [Rdb_ChangeInfo](#rdb_changeinfo) | Defines a struct for the details about the device-cloud synchronization process.|
73| [Rdb_SubscribeType](#rdb_subscribetype) | Defines an enum for subscription types.|
74| [Rdb_SyncMode](#rdb_syncmode) | Defines an enum for RDB synchronization modes.|
75| [Rdb_Statistic](#rdb_statistic) | Defines a struct for the device-cloud synchronization statistics of a database table. |
76| [Rdb_TableDetails](#rdb_tabledetails) | Defines a struct for statistics of device-cloud upload and download tasks of a database table. |
77| [Rdb_Progress](#rdb_progress) | Defines an enum for device-cloud synchronization progresses. |
78| [Rdb_ProgressCode](#rdb_progresscode) | Defines an enum for device-cloud synchronization states.|
79| [Rdb_ProgressDetails](#rdb_progressdetails) | Defines a struct for statistics of the overall device-cloud synchronization (upload and download) tasks of an RDB store. |
80| [Rdb_SyncCallback](#rdb_synccallback) | Defines a callback for device-cloud synchronization.|
81| [OH_Rdb_ErrCode](#oh_rdb_errcode) | Defines an enum for error codes.|
82
83
84### Enums
85
86| Name| Description|
87| -------- | -------- |
88| [OH_ColumnType](#oh_columntype) {<br>TYPE_NULL = 0, TYPE_INT64, TYPE_REAL, TYPE_TEXT,<br>TYPE_BLOB, TYPE_ASSET, TYPE_ASSETS<br>} | Enumerates the types of the fields in an RDB store.|
89| [OH_OrderType](#oh_ordertype) { ASC = 0, DESC = 1 } | Enumerates the sorting types.|
90| [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel) { S1 = 1, S2, S3, S4 } | Enumerates the RDB store security levels.|
91| [Rdb_SecurityArea](#rdb_securityarea) { RDB_SECURITY_AREA_EL1 = 1, RDB_SECURITY_AREA_EL2, RDB_SECURITY_AREA_EL3, RDB_SECURITY_AREA_EL4 } | Enumerates the security area levels of an RDB store.|
92| [Rdb_DistributedType](#rdb_distributedtype) { RDB_DISTRIBUTED_CLOUD } | Enumerates the distributed types.|
93| [Rdb_ChangeType](#rdb_changetype) { RDB_DATA_CHANGE, RDB_ASSET_CHANGE } | Enumerates the data change types.|
94| [Rdb_SubscribeType](#rdb_subscribetype) { RDB_SUBSCRIBE_TYPE_CLOUD, RDB_SUBSCRIBE_TYPE_CLOUD_DETAILS } | Enumerates the subscription types.|
95| [Rdb_SyncMode](#rdb_syncmode) { RDB_SYNC_MODE_TIME_FIRST, RDB_SYNC_MODE_NATIVE_FIRST, RDB_SYNC_MODE_CLOUD_FIRST } | Enumerates the RDB synchronization modes.|
96| [Rdb_Progress](#rdb_progress) { RDB_SYNC_BEGIN, RDB_SYNC_IN_PROGRESS, RDB_SYNC_FINISH } | Enumerates the device-cloud synchronization progresses. |
97| [Rdb_ProgressCode](#rdb_progresscode) {<br>RDB_SUCCESS, RDB_UNKNOWN_ERROR, RDB_NETWORK_ERROR, RDB_CLOUD_DISABLED,<br>RDB_LOCKED_BY_OTHERS, RDB_RECORD_LIMIT_EXCEEDED, RDB_NO_SPACE_FOR_ASSET<br>} | Enumerates the device-cloud synchronization states.|
98| [OH_Rdb_ErrCode](#oh_rdb_errcode) {<br>RDB_ERR = -1, RDB_OK = 0, E_BASE = 14800000, RDB_E_NOT_SUPPORTED = 801,<br>RDB_E_ERROR = E_BASE, RDB_E_INVALID_ARGS = (E_BASE + 1), RDB_E_CANNOT_UPDATE_READONLY = (E_BASE + 2), RDB_E_REMOVE_FILE = (E_BASE + 3),<br>RDB_E_EMPTY_TABLE_NAME = (E_BASE + 5), RDB_E_EMPTY_VALUES_BUCKET = (E_BASE + 6), RDB_E_EXECUTE_IN_STEP_QUERY = (E_BASE + 7), RDB_E_INVALID_COLUMN_INDEX = (E_BASE + 8),<br>RDB_E_INVALID_COLUMN_TYPE = (E_BASE + 9), RDB_E_EMPTY_FILE_NAME = (E_BASE + 10), RDB_E_INVALID_FILE_PATH = (E_BASE + 11), RDB_E_TRANSACTION_IN_EXECUTE = (E_BASE + 12),<br>RDB_E_INVALID_STATEMENT = (E_BASE + 13), RDB_E_EXECUTE_WRITE_IN_READ_CONNECTION = (E_BASE + 14), RDB_E_BEGIN_TRANSACTION_IN_READ_CONNECTION = (E_BASE + 15), RDB_E_NO_TRANSACTION_IN_SESSION = (E_BASE + 16),<br>RDB_E_MORE_STEP_QUERY_IN_ONE_SESSION = (E_BASE + 17), RDB_E_NO_ROW_IN_QUERY = (E_BASE + 18), RDB_E_INVALID_BIND_ARGS_COUNT = (E_BASE + 19), RDB_E_INVALID_OBJECT_TYPE = (E_BASE + 20),<br>RDB_E_INVALID_CONFLICT_FLAG = (E_BASE + 21), RDB_E_HAVING_CLAUSE_NOT_IN_GROUP_BY = (E_BASE + 22), RDB_E_NOT_SUPPORTED_BY_STEP_RESULT_SET = (E_BASE + 23), RDB_E_STEP_RESULT_SET_CROSS_THREADS = (E_BASE + 24),<br>RDB_E_STEP_RESULT_QUERY_NOT_EXECUTED = (E_BASE + 25), RDB_E_STEP_RESULT_IS_AFTER_LAST = (E_BASE + 26), RDB_E_STEP_RESULT_QUERY_EXCEEDED = (E_BASE + 27), RDB_E_STATEMENT_NOT_PREPARED = (E_BASE + 28),<br>RDB_E_EXECUTE_RESULT_INCORRECT = (E_BASE + 29), RDB_E_STEP_RESULT_CLOSED = (E_BASE + 30), RDB_E_RELATIVE_PATH = (E_BASE + 31), RDB_E_EMPTY_NEW_ENCRYPT_KEY = (E_BASE + 32),<br>RDB_E_CHANGE_UNENCRYPTED_TO_ENCRYPTED = (E_BASE + 33), RDB_E_CHANGE_ENCRYPT_KEY_IN_BUSY = (E_BASE + 34), RDB_E_STEP_STATEMENT_NOT_INIT = (E_BASE + 35), RDB_E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE = (E_BASE + 36),<br>RDB_E_CREATE_FOLDER_FAIL = (E_BASE + 37), RDB_E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL = (E_BASE + 38), RDB_E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY = (E_BASE + 39), RDB_E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 40),<br>RDB_E_NOT_SUPPORT = (E_BASE + 41), RDB_E_INVALID_PARCEL = (E_BASE + 42), RDB_E_QUERY_IN_EXECUTE = (E_BASE + 43), RDB_E_SET_PERSIST_WAL = (E_BASE + 44),<br>RDB_E_DB_NOT_EXIST = (E_BASE + 45), RDB_E_ARGS_READ_CON_OVERLOAD = (E_BASE + 46), RDB_E_WAL_SIZE_OVER_LIMIT = (E_BASE + 47), RDB_E_CON_OVER_LIMIT = (E_BASE + 48)<br>} | Enumerates the RDB store error codes.|
99
100
101### Functions
102
103| Name| Description|
104| -------- | -------- |
105| [OH_VBucket_PutAsset](#oh_vbucket_putasset) ([OH_VBucket](_o_h___v_bucket.md) \*bucket, const char \*field, OH_Asset \*value) | Puts an **OH_Asset** object into the [OH_VBucket](_o_h___v_bucket.md) object with the given column name.|
106| [OH_VBucket_PutAssets](#oh_vbucket_putassets) ([OH_VBucket](_o_h___v_bucket.md) \*bucket, const char \*field, OH_Asset \*\*value, int count) | Puts an array of **OH_Asset** objects into the [OH_VBucket](_o_h___v_bucket.md) object with the given column name.|
107| [OH_Rdb_CreateValueObject](#oh_rdb_createvalueobject) (void) | Creates an [OH_VObject](_o_h___v_object.md) instance.|
108| [OH_Rdb_CreateValuesBucket](#oh_rdb_createvaluesbucket) (void) | Creates an [OH_VBucket](_o_h___v_bucket.md) instance.|
109| [OH_Rdb_CreatePredicates](#oh_rdb_createpredicates) (const char \*table) | Creates an [OH_Predicates](_o_h___predicates.md) instance.|
110| [OH_Rdb_GetOrOpen](#oh_rdb_getoropen) (const [OH_Rdb_Config](_o_h___rdb___config.md) \*config, int \*errCode) | Obtains an [OH_Rdb_Store](_o_h___rdb___store.md) instance for RDB store operations.|
111| [OH_Rdb_CloseStore](#oh_rdb_closestore) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Destroys an [OH_Rdb_Store](_o_h___rdb___store.md) object to reclaim the memory occupied. |
112| [OH_Rdb_DeleteStore](#oh_rdb_deletestore) (const [OH_Rdb_Config](_o_h___rdb___config.md) \*config) | Deletes an RDB store with the specified database file configuration.|
113| [OH_Rdb_Insert](#oh_rdb_insert) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const char \*table, [OH_VBucket](_o_h___v_bucket.md) \*valuesBucket) | Inserts a row of data into a table.|
114| [OH_Rdb_Update](#oh_rdb_update) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_VBucket](_o_h___v_bucket.md) \*valuesBucket, [OH_Predicates](_o_h___predicates.md) \*predicates) | Updates data in an RDB store based on specified conditions.|
115| [OH_Rdb_Delete](#oh_rdb_delete) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_Predicates](_o_h___predicates.md) \*predicates) | Deletes data from an RDB store based on specified conditions.|
116| [OH_Rdb_Query](#oh_rdb_query) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_Predicates](_o_h___predicates.md) \*predicates, const char \*const \*columnNames, int length) | Queries data in an RDB store based on specified conditions.|
117| [OH_Rdb_Execute](#oh_rdb_execute) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const char \*sql) | Executes an SQL statement but returns no value.|
118| [OH_Rdb_ExecuteQuery](#oh_rdb_executequery) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const char \*sql) | Executes the SQL statement to query data in an RDB store.|
119| [OH_Rdb_BeginTransaction](#oh_rdb_begintransaction) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Starts the transaction before executing the SQL statement.|
120| [OH_Rdb_RollBack](#oh_rdb_rollback) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Rolls back the SQL statements executed.|
121| [OH_Rdb_Commit](#oh_rdb_commit) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Commits the executed SQL statements.|
122| [OH_Rdb_Backup](#oh_rdb_backup) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const char \*databasePath) | Backs up an RDB store in the specified directory.|
123| [OH_Rdb_Restore](#oh_rdb_restore) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const char \*databasePath) | Restores an RDB store from the specified database backup file.|
124| [OH_Rdb_GetVersion](#oh_rdb_getversion) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, int \*version) | Obtains the RDB store version.|
125| [OH_Rdb_SetVersion](#oh_rdb_setversion) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, int version) | Sets the RDB store version.|
126| [OH_Rdb_SetDistributedTables](#oh_rdb_setdistributedtables) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const char \*tables[], uint32_t count, [Rdb_DistributedType](#rdb_distributedtype) type, const [Rdb_DistributedConfig](_rdb___distributed_config.md) \*config) | Sets distributed database tables.|
127| [OH_Rdb_FindModifyTime](#oh_rdb_findmodifytime) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const char \*tableName, const char \*columnName, [OH_VObject](_o_h___v_object.md) \*values) | Obtains the last modification time of a table in an RDB store.|
128| [OH_Rdb_GetTableDetails](#oh_rdb_gettabledetails) ([Rdb_ProgressDetails](_rdb___progress_details.md) \*progress, int32_t version) | Obtains the device-cloud synchronization statistics of a table.|
129| [OH_Rdb_CloudSync](#oh_rdb_cloudsync) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [Rdb_SyncMode](#rdb_syncmode) mode, const char \*tables, int count, [Rdb_SyncCallback](#rdb_synccallback) \*progress) | Performs device-cloud synchronization.|
130
131
132### Variables
133
134| Name| Description|
135| -------- | -------- |
136| OH_Cursor::id | Unique identifier of the **OH_Cursor** struct.|
137| [OH_Cursor::getColumnCount](#getcolumncount) | Pointer to the function used to obtain the number of columns in the result set.|
138| [OH_Cursor::getColumnType](#getcolumntype) | Pointer to the function used to obtain the column type based on the specified column index.|
139| [OH_Cursor::getColumnIndex](#getcolumnindex) | Pointer to the function used to obtain the column index based on the specified column name.|
140| [OH_Cursor::getColumnName](#getcolumnname) | Pointer to the function used to obtain the column name based on the specified column index.|
141| [OH_Cursor::getRowCount](#getrowcount) | Pointer to the function used to obtain the number of rows in the result set.|
142| [OH_Cursor::goToNextRow](#gotonextrow) | Pointer to the function used to go to the next row of the result set.|
143| [OH_Cursor::getSize](#getsize) | Pointer to the function used to obtain information about the memory required when the column data type in the result set is **BLOB** or **TEXT**.|
144| [OH_Cursor::getText](#gettext) | Pointer to the function used to obtain the value of the string type based on the specified column and the current row. |
145| [OH_Cursor::getInt64](#getint64) | Pointer to the function used to obtain the value of the int64_t type based on the specified column and the current row.|
146| [OH_Cursor::getReal](#getreal) | Pointer to the function used to obtain the value of the double type based on the specified column and the current row.|
147| [OH_Cursor::getBlob](#getblob) | Pointer to the function used to obtain the values in the form of a byte array based on the specified column and the current row. |
148| [OH_Cursor::isNull](#isnull-12) | Pointer to the function used to check whether the value in the specified column is null.|
149| [OH_Cursor::destroy](#destroy-14) | Pointer to the function used to destroy a result set. |
150| [OH_Cursor::getAsset](#getasset) | Pointer to the function used to obtain the value of the asset type based on the specified column and the current row. |
151| [OH_Cursor::getAssets](#getassets) | Pointer to the function used to obtain the values in the form of an asset array based on the specified column and the current row. |
152| [OH_Predicates::id](#id-14) | Unique identifier of the **OH_Predicates** struct.|
153| [OH_Predicates::equalTo](#equalto) | Pointer to the function used to set a predicates object to match the field whose value is equal to the specified value.|
154| [OH_Predicates::notEqualTo](#notequalto) | Pointer to the function used to set a predicates object to match the field whose value is not equal to the specified value.|
155| [OH_Predicates::beginWrap](#beginwrap) | Pointer to the function used to add a left parenthesis to the predicates.|
156| [OH_Predicates::endWrap](#endwrap) | Pointer to the function used to add a right parenthesis to the predicates.|
157| [OH_Predicates::orOperate](#oroperate) | Pointer to the function used to add the OR operator to the predicates.|
158| [OH_Predicates::andOperate](#andoperate) | Pointer to the function used to add the AND operator to the predicates.|
159| [OH_Predicates::isNull](#isnull-22) | Pointer to the function used to set a predicates object to match the field whose value is null.|
160| [OH_Predicates::isNotNull](#isnotnull) | Pointer to the function used to set a predicates object to match the field whose value is not null.|
161| [OH_Predicates::like](#like) | Pointer to the function used to set a predicates object to match a string that is similar to the specified value.|
162| [OH_Predicates::between](#between) | Pointer to the function used to set a predicates object to match the field whose value is within the specified range.|
163| [OH_Predicates::notBetween](#notbetween) | Pointer to the function used to set a predicates object to match the field whose value is out of the specified range.|
164| [OH_Predicates::greaterThan](#greaterthan) | Pointer to the function used to set a predicates object to match the field with value greater than the specified value.|
165| [OH_Predicates::lessThan](#lessthan) | Pointer to the function used to set a predicates object to match the field with value less than the specified value.|
166| [OH_Predicates::greaterThanOrEqualTo](#greaterthanorequalto) | Pointer to the function used to set a predicates object to match the field with value greater than or equal to the specified value.|
167| [OH_Predicates::lessThanOrEqualTo](#lessthanorequalto) | Pointer to the function used to set a predicates object to match the field with value less than or equal to the specified value.|
168| [OH_Predicates::orderBy](#orderby) | Pointer to the function used to set a predicates object to sort the values in a column in ascending or descending order.|
169| [OH_Predicates::distinct](#distinct) | Pointer to the function used to set a predicates object to filter out duplicate records.|
170| [OH_Predicates::limit](#limit) | Pointer to the function used to set a predicates object to specify the maximum number of records.|
171| [OH_Predicates::offset](#offset) | Pointer to the function used to set a predicates object to specify the start position of the returned result.|
172| [OH_Predicates::groupBy](#groupby) | Pointer to the function used to set a predicates object to group rows that have the same value into summary rows.|
173| [OH_Predicates::in](#in) | Pointer to the function used to set a predicates object to match the field with the value within the specified range.|
174| [OH_Predicates::notIn](#notin) | Pointer to the function used to set a predicates object to match the field with the value out of the specified range.|
175| [OH_Predicates::clear](#clear-12) | Pointer to the function used to clear a predicates instance.|
176| [OH_Predicates::destroy](#destroy-24) | Pointer to the function used to destroy an [OH_Predicates](_o_h___predicates.md) object to reclaim the memory occupied.|
177| [OH_VObject::id](#id-24) | Unique identifier of the **OH_VObject** struct.|
178| [OH_VObject::putInt64](#putint64-22) | Pointer to the function used to convert a single parameter or an array of the int64 type into a value of the [OH_VObject](_o_h___v_object.md) type.|
179| [OH_VObject::putDouble](#putdouble) | Pointer to the function used to convert a single parameter or an array of the double type into a value of the [OH_VObject](_o_h___v_object.md) type.|
180| [OH_VObject::putText](#puttext-22) | Pointer to the function used to convert a character array of the char type to a value of the [OH_VObject](_o_h___v_object.md) type.|
181| [OH_VObject::putTexts](#puttexts) | Pointer to the function used to convert a string array of the char type to a value of the [OH_VObject](_o_h___v_object.md) type.|
182| [OH_VObject::destroy](#destroy-44) | Pointer to the function used to destroy an [OH_VObject](_o_h___v_object.md) object to reclaim the memory occupied.|
183| [OH_VBucket::id](#id-34) | Unique identifier of the **OH_VBucket** struct.|
184| [OH_VBucket::capability](#capability) | Number of the KV pairs in the struct.|
185| [OH_VBucket::putText](#puttext-12) | Pointer to the function used to put a char value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.|
186| [OH_VBucket::putInt64](#putint64-12) | Pointer to the function used to put an int64_t value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.|
187| [OH_VBucket::putReal](#putreal) | Pointer to the function used to put a double value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.|
188| [OH_VBucket::putBlob](#putblob) | Pointer to the function used to put a const uint8_t value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.|
189| [OH_VBucket::putNull](#putnull) | Pointer to the function used to put a null value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.|
190| [OH_VBucket::clear](#clear-22) | Pointer to the function used to clear an [OH_VBucket](_o_h___v_bucket.md) object.|
191| [OH_VBucket::destroy](#destroy-34) | Pointer to the function used to destroy an [OH_VBucket](_o_h___v_bucket.md) object to reclaim the memory occupied. |
192| [OH_Rdb_Config::selfSize](#selfsize) | Size of the struct.|
193| [OH_Rdb_Config::dataBaseDir](#databasedir) | Path of the database file.|
194| [OH_Rdb_Config::storeName](#storename) | Name of the RDB store.|
195| [OH_Rdb_Config::bundleName](#bundlename) | Bundle name.|
196| [OH_Rdb_Config::moduleName](#modulename) | Module name. |
197| [OH_Rdb_Config::isEncrypt](#isencrypt) | Whether to encrypt the RDB store.|
198| [OH_Rdb_Config::securityLevel](#securitylevel) | RDB store security level. For details, see [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel). |
199| [OH_Rdb_Config::area](#area) | Security area level. For details, see [Rdb_SecurityArea](#rdb_securityarea). |
200| [OH_Rdb_Store::id](#id-44) | Unique identifier of the **OH_Rdb_Store** struct.|
201| [Rdb_DistributedConfig::version](#version-13) | Version of the **Rdb_DistributedConfig** struct.|
202| [Rdb_DistributedConfig::isAutoSync](#isautosync) | Whether the table supports automatic synchronization.|
203| [Rdb_KeyInfo::count](#count) | Number of the changed primary keys or row numbers.|
204| [Rdb_KeyInfo::type](#type) | Type ([OH_ColumnType](#oh_columntype)) of the primary key.|
205| [Rdb_KeyInfo::Rdb_KeyData::integer](#integer) | Data of the uint64_t type.|
206| [Rdb_KeyInfo::Rdb_KeyData::real](#real) | Data of the double type.|
207| [Rdb_KeyInfo::Rdb_KeyData::text](#text) | Data of the char \* type.|
208| [Rdb_KeyInfo::Rdb_KeyData](union_rdb___key_info_1_1_rdb___key_data.md) | Changed data.|
209| [Rdb_ChangeInfo::version](#version-23) | Version of the **Rdb_DistributedConfig** struct.|
210| [Rdb_ChangeInfo::tableName](#tablename) | Name of the table with data changes.|
211| [Rdb_ChangeInfo::ChangeType](#changetype) | Type of the data changed, which can be data or asset.|
212| [Rdb_ChangeInfo::inserted](#inserted) | Location where data is inserted. If the primary key of the table is of the string type, the value is the value of the primary key. Otherwise, the value is the row number of the inserted data. |
213| [Rdb_ChangeInfo::updated](#updated) | Location where data is updated. If the primary key of the table is of the string type, the value is the value of the primary key. Otherwise, the value is the row number of the updated data.|
214| [Rdb_ChangeInfo::deleted](#deleted) | Location where data is deleted. If the primary key of the table is of the string type, the value is the value of the primary key. Otherwise, the value is the row number of the deleted data.|
215| [Rdb_Statistic::total](#total) | Total number of rows to be synchronized between the device and cloud in the database table.|
216| [Rdb_Statistic::successful](#successful) | Number of rows that are successfully synchronized between the device and cloud in the database table.|
217| [Rdb_Statistic::failed](#failed) | Number of rows that failed to be synchronized between the device and cloud in the database table.|
218| [Rdb_Statistic::remained](#remained) | Number of rows that are not executed for device-cloud synchronization in the database table.|
219| [Rdb_TableDetails::table](#table) | Database table name.|
220| [Rdb_TableDetails::upload](#upload) | Statistics of the device-cloud upload tasks.|
221| [Rdb_TableDetails::download](#download) | Statistics of the device-cloud download tasks.|
222| [Rdb_ProgressDetails::version](#version-33) | Version of the **OH_TableDetails** struct.|
223| [Rdb_ProgressDetails::schedule](#schedule) | Device-cloud synchronization process.|
224| [Rdb_ProgressDetails::code](#code) | Device-cloud synchronization state.|
225| [Rdb_ProgressDetails::tableLength](#tablelength) | Number of tables synchronized between the device and cloud.|
226
227
228## Macro Description
229
230
231### DISTRIBUTED_CHANGE_INFO_VERSION
232
233```
234#define DISTRIBUTED_CHANGE_INFO_VERSION   1
235```
236
237**Description**
238
239Version of [Rdb_ChangeInfo](_rdb___change_info.md).
240
241**Since**: 11
242
243
244### DISTRIBUTED_CONFIG_VERSION
245
246```
247#define DISTRIBUTED_CONFIG_VERSION   1
248```
249
250**Description**
251
252Version of [Rdb_DistributedConfig](_rdb___distributed_config.md).
253
254**Since**: 11
255
256
257### DISTRIBUTED_PROGRESS_DETAIL_VERSION
258
259```
260#define DISTRIBUTED_PROGRESS_DETAIL_VERSION   1
261```
262
263**Description**
264
265Version of **OH_ProgressDetails**.
266
267**Since**: 11
268
269
270## Type Description
271
272
273### OH_ColumnType
274
275```
276typedef enum OH_ColumnType OH_ColumnType
277```
278
279**Description**
280
281Defines an enum for the types of the fields in an RDB store.
282
283**Since**: 10
284
285
286### OH_Cursor
287
288```
289typedef struct OH_Cursor OH_Cursor
290```
291
292**Description**
293
294Defines a struct for a result set.
295
296APIs are provided to access the result set obtained by querying the RDB store.
297
298**Since**: 10
299
300
301### OH_OrderType
302
303```
304typedef enum OH_OrderTypeOH_OrderType
305```
306
307**Description**
308
309Defines an enum for sorting types.
310
311**Since**: 10
312
313
314### OH_Predicates
315
316```
317typedef struct OH_PredicatesOH_Predicates
318```
319
320**Description**
321
322Defines a **predicates** object.
323
324**Since**: 10
325
326
327### OH_Rdb_ErrCode
328
329```
330typedef enum OH_Rdb_ErrCodeOH_Rdb_ErrCode
331```
332
333**Description**
334
335Defines an enum for error codes.
336
337**Since**: 10
338
339
340### OH_Rdb_SecurityLevel
341
342```
343typedef enum OH_Rdb_SecurityLevelOH_Rdb_SecurityLevel
344```
345
346**Description**
347
348Defines an enum for RDB store security levels.
349
350**Since**: 10
351
352
353### OH_VBucket
354
355```
356typedef struct OH_VBucketOH_VBucket
357```
358
359**Description**
360
361Defines a struct for the types of the key and value in a KV pair.
362
363**Since**: 10
364
365
366### OH_VObject
367
368```
369typedef struct OH_VObjectOH_VObject
370```
371
372**Description**
373
374Defines a struct for allowed data field types.
375
376**Since**: 10
377
378
379### Rdb_ChangeInfo
380
381```
382typedef struct Rdb_ChangeInfoRdb_ChangeInfo
383```
384
385**Description**
386
387Defines a struct for the details about the device-cloud synchronization process.
388
389**Since**: 11
390
391
392### Rdb_ChangeType
393
394```
395typedef enum Rdb_ChangeTypeRdb_ChangeType
396```
397
398**Description**
399
400Defines an enum for data change types.
401
402**Since**: 11
403
404
405### Rdb_DistributedConfig
406
407```
408typedef struct Rdb_DistributedConfigRdb_DistributedConfig
409```
410
411**Description**
412
413Defines a struct for distributed configuration of a table.
414
415**Since**: 11
416
417
418### Rdb_DistributedType
419
420```
421typedef enum Rdb_DistributedTypeRdb_DistributedType
422```
423
424**Description**
425
426Defines an enum for distributed types.
427
428**Since**: 11
429
430
431### Rdb_KeyInfo
432
433```
434typedef struct Rdb_KeyInfoRdb_KeyInfo
435```
436
437**Description**
438
439Defines a struct for the primary key or row number of the row that changes.
440
441**Since**: 11
442
443
444### Rdb_Progress
445
446```
447typedef enum Rdb_ProgressRdb_Progress
448```
449
450**Description**
451
452Defines an enum for device-cloud synchronization progresses.
453
454**Since**: 11
455
456
457### Rdb_ProgressCode
458
459```
460typedef enum Rdb_ProgressCodeRdb_ProgressCode
461```
462
463**Description**
464
465Defines an enum for device-cloud synchronization states.
466
467**Since**: 11
468
469
470### Rdb_ProgressDetails
471
472```
473typedef struct Rdb_ProgressDetailsRdb_ProgressDetails
474```
475
476**Description**
477
478Defines a struct for statistics of the overall device-cloud synchronization (upload and download) tasks of an RDB store.
479
480**Since**: 11
481
482
483### Rdb_SecurityArea
484
485```
486typedef enum Rdb_SecurityAreaRdb_SecurityArea
487```
488
489**Description**
490
491Defines an enum for security area levels of an RDB store.
492
493**Since**: 11
494
495
496### Rdb_Statistic
497
498```
499typedef struct Rdb_StatisticRdb_Statistic
500```
501
502**Description**
503
504Defines a struct for the device-cloud synchronization statistics of a database table.
505
506**Since**: 11
507
508
509### Rdb_SubscribeType
510
511```
512typedef enum Rdb_SubscribeTypeRdb_SubscribeType
513```
514
515**Description**
516
517Defines an enum for subscription types.
518
519**Since**: 11
520
521
522### Rdb_SyncCallback
523
524```
525typedef void(* Rdb_SyncCallback) (Rdb_ProgressDetails *progressDetails)
526```
527
528**Description**
529
530Defines a callback for device-cloud synchronization.
531
532**Since**: 11
533
534**Parameters**
535
536| Name| Description|
537| -------- | -------- |
538| progressDetails | Statistics of device-cloud synchronization.|
539
540**See**
541
542[OH_Rdb_Store](_o_h___rdb___store.md).
543
544
545### Rdb_SyncMode
546
547```
548typedef enum Rdb_SyncModeRdb_SyncMode
549```
550
551**Description**
552
553Defines an enum for RDB synchronization modes.
554
555**Since**: 11
556
557
558### Rdb_TableDetails
559
560```
561typedef struct Rdb_TableDetailsRdb_TableDetails
562```
563
564**Description**
565
566Defines a struct for statistics of device-cloud upload and download tasks of a database table.
567
568**Since**: 11
569
570## Enum Description
571
572
573### OH_ColumnType
574
575```
576enum OH_ColumnType
577```
578
579**Description**
580
581Enumerates the field types in an RDB store.
582
583**Since**: 10
584
585| Value| Description|
586| -------- | -------- |
587| TYPE_NULL | Null.|
588| TYPE_INT64 | INT64.|
589| TYPE_REAL | REAL.|
590| TYPE_TEXT | TEXT.|
591| TYPE_BLOB | BLOB.|
592| TYPE_ASSET<sup>11+</sup> | ASSET (asset attachment).<br>This value is supported since API version 11.|
593| TYPE_ASSETS<sup>11+</sup> | ASSETS (multiple asset attachments).<br>This value is supported since API version 11.|
594
595
596### OH_OrderType
597
598```
599enum OH_OrderType
600```
601
602**Description**
603
604Enumerates the sorting types.
605
606**Since**: 10
607
608| Value| Description|
609| -------- | -------- |
610| ASC | Ascending order.|
611| DESC | Descending order.|
612
613
614### OH_Rdb_ErrCode
615
616```
617enum OH_Rdb_ErrCode
618```
619
620**Description**
621
622Enumerates the error codes.
623
624**Since**: 10
625
626| Value| Description|
627| -------- | -------- |
628| RDB_ERR | Execution failed.|
629| RDB_OK | Execution successful.|
630| E_BASE | Base of the error code.|
631| RDB_E_NOT_SUPPORTED | The RDB store does not have this capability.|
632| RDB_E_ERROR | Common exception.|
633| RDB_E_INVALID_ARGS | Invalid parameter.|
634| RDB_E_CANNOT_UPDATE_READONLY | Failed to update data because the RDB store is read-only.|
635| RDB_E_REMOVE_FILE | Failed to delete the file.|
636| RDB_E_EMPTY_TABLE_NAME | The table name is empty.|
637| RDB_E_EMPTY_VALUES_BUCKET | The content of the KV pair is empty.|
638| RDB_E_EXECUTE_IN_STEP_QUERY | The SQL statement executed during the query is incorrect.|
639| RDB_E_INVALID_COLUMN_INDEX | The column index is invalid.|
640| RDB_E_INVALID_COLUMN_TYPE | The column type is invalid.|
641| RDB_E_EMPTY_FILE_NAME | The file name is empty.|
642| RDB_E_INVALID_FILE_PATH | The file path is invalid.|
643| RDB_E_TRANSACTION_IN_EXECUTE | Failed to start the transaction.|
644| RDB_E_INVALID_STATEMENT | Failed to precompile the SQL statement.|
645| RDB_E_EXECUTE_WRITE_IN_READ_CONNECTION | Failed to perform a write operation in a read connection.|
646| RDB_E_BEGIN_TRANSACTION_IN_READ_CONNECTION | Failed to start the transaction in a read connection.|
647| RDB_E_NO_TRANSACTION_IN_SESSION | The transaction to start does not exist in the database session.|
648| RDB_E_MORE_STEP_QUERY_IN_ONE_SESSION | Multiple queries are executed in a database session.|
649| RDB_E_NO_ROW_IN_QUERY | The result set does not contain any record.|
650| RDB_E_INVALID_BIND_ARGS_COUNT | The number of parameters bound in the SQL statement is invalid.|
651| RDB_E_INVALID_OBJECT_TYPE | The object type is invalid.|
652| RDB_E_INVALID_CONFLICT_FLAG | The conflict resolution type is invalid.|
653| RDB_E_HAVING_CLAUSE_NOT_IN_GROUP_BY | The HAVING keyword can be used only after GROUP BY.|
654| RDB_E_NOT_SUPPORTED_BY_STEP_RESULT_SET | The result set by step is not supported.|
655| RDB_E_STEP_RESULT_SET_CROSS_THREADS | Failed to obtain the result set.|
656| RDB_E_STEP_RESULT_QUERY_NOT_EXECUTED | The result set query statement is not executed.|
657| RDB_E_STEP_RESULT_IS_AFTER_LAST | The cursor of the result set is already in the last row.|
658| RDB_E_STEP_RESULT_QUERY_EXCEEDED | The number of result set query times exceeds the limit.|
659| RDB_E_STATEMENT_NOT_PREPARED | The SQL statement is not precompiled.|
660| RDB_E_EXECUTE_RESULT_INCORRECT | The database execution result is incorrect.|
661| RDB_E_STEP_RESULT_CLOSED | The result set has been closed.|
662| RDB_E_RELATIVE_PATH | The file path is a relative path.|
663| RDB_E_EMPTY_NEW_ENCRYPT_KEY | The new encrypt key is empty.|
664| RDB_E_CHANGE_UNENCRYPTED_TO_ENCRYPTED | The RDB store is non-encrypted and cannot be changed.|
665| RDB_E_CHANGE_ENCRYPT_KEY_IN_BUSY | The database does not respond when the database key is updated.|
666| RDB_E_STEP_STATEMENT_NOT_INIT | The precompiled SQL statement is not initialized.|
667| RDB_E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE | The WAL mode does not support the ATTACH operation.|
668| RDB_E_CREATE_FOLDER_FAIL | Failed to create the folder.|
669| RDB_E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL | Failed to build the SQL statement.|
670| RDB_E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY | The database session does not provide a connection.|
671| RDB_E_STORE_SESSION_NO_CURRENT_TRANSACTION | The transaction does not exist in the database session.|
672| RDB_E_NOT_SUPPORT | The current operation is not supported.|
673| RDB_E_INVALID_PARCEL | The current PARCEL is invalid.|
674| RDB_E_QUERY_IN_EXECUTE | Failed to execute query.|
675| RDB_E_SET_PERSIST_WAL | Failed to set the persistence of the database file in WAL mode.|
676| RDB_E_DB_NOT_EXIST | The database does not exist.|
677| RDB_E_ARGS_READ_CON_OVERLOAD | The number of read connections to set is greater than the limit.|
678| RDB_E_WAL_SIZE_OVER_LIMIT | The WAL log file size exceeds the default value.|
679| RDB_E_CON_OVER_LIMIT | The number of database connections has reached the limit.|
680
681
682### OH_Rdb_SecurityLevel
683
684```
685enum OH_Rdb_SecurityLevel
686```
687
688**Description**
689
690Enumerates the RDB store security levels.
691
692**Since**: 10
693
694| Value| Description|
695| -------- | -------- |
696| S1 | The security level of the RDB store is low.<br>If data leakage occurs, minor impact will be caused.|
697| S2 | The security level of the RDB store is medium.<br>If data leakage occurs, moderate impact will be caused.|
698| S3 | The security level of the RDB store is high.<br>If data leakage occurs, major impact will be caused.|
699| S4 | The security level of the RDB store is critical.<br>If data leakage occurs, critical impact will be caused.|
700
701
702### Rdb_ChangeType
703
704```
705enum Rdb_ChangeType
706```
707
708**Description**
709
710Enumerates the data change types.
711
712**Since**: 11
713
714| Value| Description|
715| -------- | -------- |
716| RDB_DATA_CHANGE | Data change.|
717| RDB_ASSET_CHANGE | Asset change.|
718
719
720### Rdb_DistributedType
721
722```
723enum Rdb_DistributedType
724```
725
726**Description**
727
728Enumerates the distributed types.
729
730**Since**: 11
731
732| Value| Description|
733| -------- | -------- |
734| RDB_DISTRIBUTED_CLOUD | Distributed database tables for device-cloud synchronization.|
735
736
737### Rdb_Progress
738
739```
740enum Rdb_Progress
741```
742
743**Description**
744
745Enumerates the device-cloud synchronization progresses.
746
747**Since**: 11
748
749| Value| Description|
750| -------- | -------- |
751| RDB_SYNC_BEGIN | The device-cloud synchronization starts.|
752| RDB_SYNC_IN_PROGRESS | The device-cloud synchronization is in progress.|
753| RDB_SYNC_FINISH | The device-cloud synchronization is finished.|
754
755
756### Rdb_ProgressCode
757
758```
759enum Rdb_ProgressCode
760```
761
762**Description**
763
764Enumerates the device-cloud synchronization states.
765
766**Since**: 11
767
768| Value| Description|
769| -------- | -------- |
770| RDB_SUCCESS | The device-cloud synchronization is successful.|
771| RDB_UNKNOWN_ERROR | An unknown error occurs during the device-cloud synchronization.|
772| RDB_NETWORK_ERROR | A network error occurs during the device-cloud synchronization.|
773| RDB_CLOUD_DISABLED | The cloud is unavailable.|
774| RDB_LOCKED_BY_OTHERS | The device-cloud synchronization of another device is being performed.|
775| RDB_RECORD_LIMIT_EXCEEDED | The number of records or size of the data to be synchronized exceeds the maximum. The maximum value is configured on the cloud.|
776| RDB_NO_SPACE_FOR_ASSET | The remaining cloud space is less than the size of the data to be synchronized.|
777
778
779### Rdb_SecurityArea
780
781```
782enum Rdb_SecurityArea
783```
784
785**Description**
786
787Enumerates the security area levels of an RDB store.
788
789**Since**: 11
790
791| Value| Description|
792| -------- | -------- |
793| RDB_SECURITY_AREA_EL1 | Security area level 1.|
794| RDB_SECURITY_AREA_EL2 | Security area level 2.|
795| RDB_SECURITY_AREA_EL3 | Security area level 3.|
796| RDB_SECURITY_AREA_EL4 | Security area level 4.|
797
798
799### Rdb_SubscribeType
800
801```
802enum Rdb_SubscribeType
803```
804
805**Description**
806
807Enumerates the subscription types.
808
809**Since**: 11
810
811| Value| Description|
812| -------- | -------- |
813| RDB_SUBSCRIBE_TYPE_CLOUD | Subscription of cloud data changes.|
814| RDB_SUBSCRIBE_TYPE_CLOUD_DETAILS | Subscription of cloud data change details.|
815
816
817### Rdb_SyncMode
818
819```
820enum Rdb_SyncMode
821```
822
823**Description**
824
825Enumerates the RDB synchronization modes.
826
827**Since**: 11
828
829| Value| Description|
830| -------- | -------- |
831| RDB_SYNC_MODE_TIME_FIRST | Synchronize with the data with the latest modification time.|
832| RDB_SYNC_MODE_NATIVE_FIRST | Synchronize data from a local device to the cloud.|
833| RDB_SYNC_MODE_CLOUD_FIRST | Synchronize data from the cloud to a local device.|
834
835
836## Function Description
837
838
839### OH_Rdb_Backup()
840
841```
842int OH_Rdb_Backup (OH_Rdb_Store * store, const char * databasePath )
843```
844
845**Description**
846
847Backs up an RDB store in the specified directory.
848
849**Since**: 10
850
851**Parameters**
852
853| Name| Description|
854| -------- | -------- |
855| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
856| databasePath | Pointer to the destination directory in which the RDB store is backed up.|
857
858**Returns**
859
860Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
861
862**See**
863
864[OH_Rdb_Store](_o_h___rdb___store.md).
865
866
867### OH_Rdb_BeginTransaction()
868
869```
870int OH_Rdb_BeginTransaction (OH_Rdb_Store * store)
871```
872
873**Description**
874
875Starts the transaction before executing the SQL statement.
876
877**Since**: 10
878
879**Parameters**
880
881| Name| Description|
882| -------- | -------- |
883| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
884
885**Returns**
886
887Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
888
889**See**
890
891[OH_Rdb_Store](_o_h___rdb___store.md).
892
893
894### OH_Rdb_CloseStore()
895
896```
897int OH_Rdb_CloseStore (OH_Rdb_Store * store)
898```
899
900**Description**
901
902Destroys an [OH_Rdb_Store](_o_h___rdb___store.md) object to reclaim the memory occupied.
903
904**Since**: 10
905
906**Parameters**
907
908| Name| Description|
909| -------- | -------- |
910| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
911
912**Returns**
913
914Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
915
916**See**
917
918[OH_Rdb_Store](_o_h___rdb___store.md).
919
920
921### OH_Rdb_CloudSync()
922
923```
924int OH_Rdb_CloudSync (OH_Rdb_Store * store, Rdb_SyncMode mode, const char * tables, int count, Rdb_SyncCallback * progress )
925```
926
927**Description**
928
929Performs device-cloud synchronization.
930
931**Since**: 11
932
933**Parameters**
934
935| Name| Description|
936| -------- | -------- |
937| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
938| mode | Synchronization mode [Rdb_SyncMode](#rdb_syncmode).|
939| tables | Pointer to the names of the tables to be synchronized.|
940| count | Number of tables to synchronize. If the value is **0**, all tables in the database are synchronized.|
941| progress | Pointer to the callback to be invoked.|
942
943**See**
944
945[OH_Rdb_Store](_o_h___rdb___store.md).
946
947
948### OH_Rdb_Commit()
949
950```
951int OH_Rdb_Commit (OH_Rdb_Store * store)
952```
953
954**Description**
955
956Commits the executed SQL statements.
957
958**Since**: 10
959
960**Parameters**
961
962| Name| Description|
963| -------- | -------- |
964| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
965
966**Returns**
967
968Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
969
970**See**
971
972[OH_Rdb_Store](_o_h___rdb___store.md).
973
974
975### OH_Rdb_CreatePredicates()
976
977```
978OH_Predicates* OH_Rdb_CreatePredicates (const char * table)
979```
980
981**Description**
982
983Creates an [OH_Predicates](_o_h___predicates.md) instance.
984
985**Since**: 10
986
987**Parameters**
988
989| Name| Description|
990| -------- | -------- |
991| table | Pointer to the name of the database table.|
992
993**Returns**
994
995Returns the pointer to the [OH_Predicates](_o_h___predicates.md) instance created if the operation is successful; returns null otherwise.
996
997**See**
998
999[OH_Predicates](_o_h___predicates.md).
1000
1001
1002### OH_Rdb_CreateValueObject()
1003
1004```
1005OH_VObject* OH_Rdb_CreateValueObject (void )
1006```
1007
1008**Description**
1009
1010Creates an [OH_VObject](_o_h___v_object.md) instance.
1011
1012**Since**: 10
1013
1014**Returns**
1015
1016Returns the pointer to the [OH_VObject](_o_h___v_object.md) instance created if the operation is successful; returns null otherwise.
1017
1018**See**
1019
1020[OH_VObject](_o_h___v_object.md).
1021
1022
1023### OH_Rdb_CreateValuesBucket()
1024
1025```
1026OH_VBucket* OH_Rdb_CreateValuesBucket (void )
1027```
1028
1029**Description**
1030
1031Creates an [OH_VBucket](_o_h___v_bucket.md) instance.
1032
1033**Since**: 10
1034
1035**Returns**
1036
1037Returns the pointer to the [OH_VBucket](_o_h___v_bucket.md) instance created if the operation is successful; returns null otherwise.
1038
1039**See**
1040
1041[OH_VBucket](_o_h___v_bucket.md).
1042
1043
1044### OH_Rdb_Delete()
1045
1046```
1047int OH_Rdb_Delete (OH_Rdb_Store * store, OH_Predicates * predicates )
1048```
1049
1050**Description**
1051
1052Deletes data from an RDB store based on specified conditions.
1053
1054**Since**: 10
1055
1056**Parameters**
1057
1058| Name| Description|
1059| -------- | -------- |
1060| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1061| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance, which specifies the deletion conditions.|
1062
1063**Returns**
1064
1065Returns the number of affected rows if the operation is successful; returns an error code otherwise.
1066
1067**See**
1068
1069[OH_Rdb_Store](_o_h___rdb___store.md), [OH_Predicates](_o_h___predicates.md).
1070
1071
1072### OH_Rdb_DeleteStore()
1073
1074```
1075int OH_Rdb_DeleteStore (const OH_Rdb_Config * config)
1076```
1077
1078**Description**
1079
1080Deletes an RDB store with the specified database file configuration.
1081
1082**Since**: 10
1083
1084**Parameters**
1085
1086| Name| Description|
1087| -------- | -------- |
1088| path | Pointer to the database path.|
1089
1090**Returns**
1091
1092Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1093
1094
1095### OH_Rdb_Execute()
1096
1097```
1098int OH_Rdb_Execute (OH_Rdb_Store * store, const char * sql )
1099```
1100
1101**Description**
1102
1103Executes an SQL statement but returns no value.
1104
1105**Since**: 10
1106
1107**Parameters**
1108
1109| Name| Description|
1110| -------- | -------- |
1111| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1112| sql | Pointer to the SQL statement to execute.|
1113
1114**Returns**
1115
1116Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1117
1118**See**
1119
1120[OH_Rdb_Store](_o_h___rdb___store.md).
1121
1122
1123### OH_Rdb_ExecuteQuery()
1124
1125```
1126OH_Cursor* OH_Rdb_ExecuteQuery (OH_Rdb_Store * store, const char * sql )
1127```
1128
1129**Description**
1130
1131Executes the SQL statement to query data in an RDB store.
1132
1133**Since**: 10
1134
1135**Parameters**
1136
1137| Name| Description|
1138| -------- | -------- |
1139| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1140| sql | Pointer to the SQL statement to execute.|
1141
1142**Returns**
1143
1144Returns the pointer to the [OH_Cursor](_o_h___cursor.md) instance if the operation is successful; returns null otherwise.
1145
1146**See**
1147
1148[OH_Rdb_Store](_o_h___rdb___store.md).
1149
1150
1151### OH_Rdb_FindModifyTime()
1152
1153```
1154OH_Cursor* OH_Rdb_FindModifyTime (OH_Rdb_Store * store, const char * tableName, const char * columnName, OH_VObject * values )
1155```
1156
1157**Description**
1158
1159Obtains the last modification time of a table in an RDB store.
1160
1161**Since**: 11
1162
1163**Parameters**
1164
1165| Name| Description|
1166| -------- | -------- |
1167| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1168| tableName | Pointer to the target distributed database table.|
1169| columnName | Pointer to the column of the database table to query.|
1170| values | Pointer to the primary keys of the rows to query. If the database table has no primary key, **rowid** must be passed in through **columnName**. In this case, **values** specifies the row number of the database table to query.|
1171
1172**Returns**
1173
1174Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1175
1176**See**
1177
1178[OH_Rdb_Store](_o_h___rdb___store.md).
1179
1180
1181### OH_Rdb_GetOrOpen()
1182
1183```
1184OH_Rdb_Store* OH_Rdb_GetOrOpen (const OH_Rdb_Config * config, int * errCode )
1185```
1186
1187**Description**
1188
1189Obtains an [OH_Rdb_Store](_o_h___rdb___store.md) instance for RDB store operations.
1190
1191**Since**: 10
1192
1193**Parameters**
1194
1195| Name| Description|
1196| -------- | -------- |
1197| config | Pointer to the [OH_Rdb_Config](_o_h___rdb___config.md) instance, which specifies the database configuration.|
1198| errCode | Function execution status.|
1199
1200**Returns**
1201
1202Returns the pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance created if the operation is successful; returns null otherwise.
1203
1204**See**
1205
1206[OH_Rdb_Config](_o_h___rdb___config.md), [OH_Rdb_Store](_o_h___rdb___store.md).
1207
1208
1209### OH_Rdb_GetTableDetails()
1210
1211```
1212Rdb_TableDetails* OH_Rdb_GetTableDetails (Rdb_ProgressDetails * progress, int32_t version )
1213```
1214
1215**Description**
1216
1217Obtains the device-cloud synchronization statistics of a table.
1218
1219**Since**: 11
1220
1221**Parameters**
1222
1223| Name| Description|
1224| -------- | -------- |
1225| progress | Pointer to the **OH_ProgressDetails** instance.|
1226| version | Version of [Rdb_ProgressDetails](_rdb___progress_details.md).|
1227
1228**Returns**
1229
1230Returns a pointer to [Rdb_TableDetails](_rdb___table_details.md) if the operation is successful; returns null otherwise.
1231
1232**See**
1233
1234[Rdb_ProgressDetails](_rdb___progress_details.md)
1235
1236[Rdb_TableDetails](_rdb___table_details.md)
1237
1238
1239### OH_Rdb_GetVersion()
1240
1241```
1242int OH_Rdb_GetVersion (OH_Rdb_Store * store, int * version )
1243```
1244
1245**Description**
1246
1247Obtains the RDB store version.
1248
1249**Since**: 10
1250
1251**Parameters**
1252
1253| Name| Description|
1254| -------- | -------- |
1255| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1256| version | Pointer to the version number.|
1257
1258**Returns**
1259
1260Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1261
1262**See**
1263
1264[OH_Rdb_Store](_o_h___rdb___store.md).
1265
1266
1267### OH_Rdb_Insert()
1268
1269```
1270int OH_Rdb_Insert (OH_Rdb_Store * store, const char * table, OH_VBucket * valuesBucket )
1271```
1272
1273**Description**
1274
1275Inserts a row of data into a table.
1276
1277**Since**: 10
1278
1279**Parameters**
1280
1281| Name| Description|
1282| -------- | -------- |
1283| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1284| table | Pointer to the target table.|
1285| valuesBucket | Pointer to the data [OH_VBucket](_o_h___v_bucket.md) to insert.|
1286
1287**Returns**
1288
1289Returns the row ID if the operation is successful; returns an error code otherwise.
1290
1291**See**
1292
1293[OH_Rdb_Store](_o_h___rdb___store.md), [OH_VBucket](_o_h___v_bucket.md).
1294
1295
1296### OH_Rdb_Query()
1297
1298```
1299OH_Cursor* OH_Rdb_Query (OH_Rdb_Store * store, OH_Predicates * predicates, const char *const * columnNames, int length )
1300```
1301
1302**Description**
1303
1304Queries data in an RDB store based on specified conditions.
1305
1306**Since**: 10
1307
1308**Parameters**
1309
1310| Name| Description|
1311| -------- | -------- |
1312| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1313| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance, which specifies the query conditions.|
1314| columnNames | Pointer to the columns to query. If this parameter is not specified, data of columns will be queried.|
1315| length | Length of the **columnNames** array. If <b>length</b> is greater than the length of <b>columnNames</b> array, out-of-bounds access occurs.|
1316
1317**Returns**
1318
1319Returns the pointer to the [OH_Cursor](_o_h___cursor.md) instance if the operation is successful; returns null otherwise.
1320
1321**See**
1322
1323[OH_Rdb_Store](_o_h___rdb___store.md), [OH_Predicates](_o_h___predicates.md), [OH_Cursor](_o_h___cursor.md).
1324
1325
1326### OH_Rdb_Restore()
1327
1328```
1329int OH_Rdb_Restore (OH_Rdb_Store * store, const char * databasePath )
1330```
1331
1332**Description**
1333
1334Restores an RDB store from the specified database backup file.
1335
1336**Since**: 10
1337
1338**Parameters**
1339
1340| Name| Description|
1341| -------- | -------- |
1342| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1343| databasePath | Pointer to the destination directory in which the RDB store is backed up.|
1344
1345**Returns**
1346
1347Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1348
1349**See**
1350
1351[OH_Rdb_Store](_o_h___rdb___store.md).
1352
1353
1354### OH_Rdb_RollBack()
1355
1356```
1357int OH_Rdb_RollBack (OH_Rdb_Store * store)
1358```
1359
1360**Description**
1361
1362Rolls back the SQL statements executed.
1363
1364**Since**: 10
1365
1366**Parameters**
1367
1368| Name| Description|
1369| -------- | -------- |
1370| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1371
1372**Returns**
1373
1374Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1375
1376**See**
1377
1378[OH_Rdb_Store](_o_h___rdb___store.md).
1379
1380
1381### OH_Rdb_SetDistributedTables()
1382
1383```
1384int OH_Rdb_SetDistributedTables (OH_Rdb_Store * store, const char * tables[], uint32_t count, Rdb_DistributedType type, const Rdb_DistributedConfig * config )
1385```
1386
1387**Description**
1388
1389Sets distributed database tables.
1390
1391**Since**: 11
1392
1393**Parameters**
1394
1395| Name| Description|
1396| -------- | -------- |
1397| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1398| tables | Pointer to the names of the distributed tables to set.|
1399| count | Number of distributed database tables to be set.|
1400| type | [Rdb_DistributedType](#rdb_distributedtype).|
1401| config | Configuration of the distributed mode. For details, see [Rdb_DistributedConfig](_rdb___distributed_config.md).|
1402
1403**Returns**
1404
1405Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1406
1407**See**
1408
1409[OH_Rdb_Store](_o_h___rdb___store.md).
1410
1411
1412### OH_Rdb_SetVersion()
1413
1414```
1415int OH_Rdb_SetVersion (OH_Rdb_Store * store, int version )
1416```
1417
1418**Description**
1419
1420Sets the RDB store version.
1421
1422**Since**: 10
1423
1424**Parameters**
1425
1426| Name| Description|
1427| -------- | -------- |
1428| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1429| version | Version number to set.|
1430
1431**Returns**
1432
1433Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1434
1435**See**
1436
1437[OH_Rdb_Store](_o_h___rdb___store.md).
1438
1439
1440### OH_Rdb_Update()
1441
1442```
1443int OH_Rdb_Update (OH_Rdb_Store * store, OH_VBucket * valuesBucket, OH_Predicates * predicates )
1444```
1445
1446**Description**
1447
1448Updates data in an RDB store based on specified conditions.
1449
1450**Since**: 10
1451
1452**Parameters**
1453
1454| Name| Description|
1455| -------- | -------- |
1456| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.|
1457| valuesBucket | Pointer to the new data [OH_VBucket](_o_h___v_bucket.md) to be updated to the table.|
1458| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance, specifying the update conditions.|
1459
1460**Returns**
1461
1462Returns the number of affected rows if the operation is successful; returns an error code otherwise.
1463
1464**See**
1465
1466[OH_Rdb_Store](_o_h___rdb___store.md), OH_Bucket, [OH_Predicates](_o_h___predicates.md).
1467
1468
1469### OH_VBucket_PutAsset()
1470
1471```
1472int OH_VBucket_PutAsset (OH_VBucket * bucket, const char * field, OH_Asset * value )
1473```
1474
1475**Description**
1476
1477Puts an **OH_Asset** object into the [OH_VBucket](_o_h___v_bucket.md) object with the given column name.
1478
1479**Since**: 11
1480
1481**Parameters**
1482
1483| Name| Description|
1484| -------- | -------- |
1485| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
1486| field | Pointer to the column name in the database table.|
1487| value | Pointer to the value to put.|
1488
1489**Returns**
1490
1491Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1492
1493**See**
1494
1495[OH_VBucket](_o_h___v_bucket.md).
1496
1497
1498### OH_VBucket_PutAssets()
1499
1500```
1501int OH_VBucket_PutAssets (OH_VBucket * bucket, const char * field, OH_Asset ** value, int count )
1502```
1503
1504**Description**
1505
1506Puts an array of **OH_Asset** objects into the [OH_VBucket](_o_h___v_bucket.md) object with the given column name.
1507
1508**Since**: 11
1509
1510**Parameters**
1511
1512| Name| Description|
1513| -------- | -------- |
1514| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
1515| field | Pointer to the column name in the database table.|
1516| value | Pointer to the value to put.|
1517| count | Number of elements in the **OH_Asset** object array.|
1518
1519**Returns**
1520
1521Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1522
1523**See**
1524
1525[OH_VBucket](_o_h___v_bucket.md).
1526
1527## Variable Description
1528
1529
1530### andOperate
1531
1532```
1533OH_Predicates*(* OH_Predicates::andOperate) (OH_Predicates *predicates)
1534```
1535
1536**Description**
1537
1538Pointer to the function used to add the AND operator to the predicates.
1539
1540This method is equivalent to **AND** in SQL statements.
1541
1542**Since**: 10
1543
1544**Parameters**
1545
1546| Name| Description|
1547| -------- | -------- |
1548| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
1549
1550**Returns**
1551
1552Returns the predicates with the AND operator.
1553
1554**See**
1555
1556[OH_Predicates](_o_h___predicates.md).
1557
1558
1559### area
1560
1561```
1562int OH_Rdb_Config::area
1563```
1564
1565**Description**
1566
1567Pointer to the function used to set [Rdb_SecurityArea](#rdb_securityarea).
1568
1569**Since**: 11
1570
1571
1572### beginWrap
1573
1574```
1575OH_Predicates*(* OH_Predicates::beginWrap) (OH_Predicates *predicates)
1576```
1577
1578**Description**
1579
1580Pointer to the function used to add a left parenthesis to the predicates.
1581
1582This method is equivalent to "(" in SQL statements.
1583
1584**Since**: 10
1585
1586**Parameters**
1587
1588| Name| Description|
1589| -------- | -------- |
1590| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
1591
1592**Returns**
1593
1594Returns the predicates with a left parenthesis.
1595
1596**See**
1597
1598[OH_Predicates](_o_h___predicates.md).
1599
1600
1601### between
1602
1603```
1604OH_Predicates*(* OH_Predicates::between) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
1605```
1606
1607**Description**
1608
1609Pointer to the function used to set a predicates object to match the field whose value is within the specified range.
1610
1611This method is equivalent to **BETWEEN** in SQL statements.
1612
1613**Since**: 10
1614
1615**Parameters**
1616
1617| Name| Description|
1618| -------- | -------- |
1619| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
1620| field | Pointer to the column name in the database table.|
1621| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the start and end values.|
1622
1623**Returns**
1624
1625Returns the predicates created.
1626
1627**See**
1628
1629[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
1630
1631
1632### bundleName
1633
1634```
1635const char* OH_Rdb_Config::bundleName
1636```
1637
1638**Description**
1639
1640Bundle name.
1641
1642
1643### capability
1644
1645```
1646uint16_t OH_VBucket::capability
1647```
1648
1649**Description**
1650
1651Number of KV pairs in the struct.
1652
1653
1654### ChangeType
1655
1656```
1657int Rdb_ChangeInfo::ChangeType
1658```
1659
1660**Description**
1661
1662Type of the data changed, which can be data or asset.
1663
1664
1665### clear [1/2]
1666
1667```
1668OH_Predicates*(* OH_Predicates::clear) (OH_Predicates *predicates)
1669```
1670
1671**Description**
1672
1673Pointer to the function used to clear a predicates instance.
1674
1675**Since**: 10
1676
1677**Parameters**
1678
1679| Name| Description|
1680| -------- | -------- |
1681| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
1682
1683**Returns**
1684
1685Returns the cleared predicates.
1686
1687**See**
1688
1689[OH_Predicates](_o_h___predicates.md).
1690
1691
1692### clear [2/2]
1693
1694```
1695int(* OH_VBucket::clear) (OH_VBucket *bucket)
1696```
1697
1698**Description**
1699
1700Clears an [OH_VBucket](_o_h___v_bucket.md) object.
1701
1702**Since**: 10
1703
1704**Parameters**
1705
1706| Name| Description|
1707| -------- | -------- |
1708| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
1709
1710**Returns**
1711
1712Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1713
1714**See**
1715
1716[OH_VBucket](_o_h___v_bucket.md).
1717
1718
1719### code
1720
1721```
1722int Rdb_ProgressDetails::code
1723```
1724
1725**Description**
1726
1727Device-cloud synchronization state.
1728
1729
1730### count
1731
1732```
1733int Rdb_KeyInfo::count
1734```
1735
1736**Description**
1737
1738Number of changed primary keys or row numbers.
1739
1740
1741### dataBaseDir
1742
1743```
1744const char* OH_Rdb_Config::dataBaseDir
1745```
1746
1747**Description**
1748
1749Path of the database file.
1750
1751
1752### deleted
1753
1754```
1755Rdb_KeyInfo Rdb_ChangeInfo::deleted
1756```
1757
1758**Description**
1759
1760Location where data is deleted. If the primary key of the table is of the string type, the value is the value of the primary key. Otherwise, the value is the row number of the deleted data.
1761
1762
1763### destroy [1/4]
1764
1765```
1766int(* OH_Cursor::destroy) (OH_Cursor *cursor)
1767```
1768
1769**Description**
1770
1771Pointer to the function used to destroy a result set.
1772
1773**Since**: 10
1774
1775**Parameters**
1776
1777| Name| Description|
1778| -------- | -------- |
1779| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
1780
1781**Returns**
1782
1783Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1784
1785**See**
1786
1787[OH_Cursor](_o_h___cursor.md).
1788
1789
1790### destroy [2/4]
1791
1792```
1793int(* OH_Predicates::destroy) (OH_Predicates *predicates)
1794```
1795
1796**Description**
1797
1798Destroys an [OH_Predicates](_o_h___predicates.md) object to reclaim the memory occupied.
1799
1800**Since**: 10
1801
1802**Parameters**
1803
1804| Name| Description|
1805| -------- | -------- |
1806| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
1807
1808**Returns**
1809
1810Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1811
1812**See**
1813
1814[OH_Predicates](_o_h___predicates.md).
1815
1816
1817### destroy [3/4]
1818
1819```
1820int(* OH_VBucket::destroy) (OH_VBucket *bucket)
1821```
1822
1823**Description**
1824
1825Destroys an [OH_VBucket](_o_h___v_bucket.md) object to reclaim the memory occupied.
1826
1827**Since**: 10
1828
1829**Parameters**
1830
1831| Name| Description|
1832| -------- | -------- |
1833| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
1834
1835**Returns**
1836
1837Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1838
1839**See**
1840
1841[OH_VBucket](_o_h___v_bucket.md).
1842
1843
1844### destroy [4/4]
1845
1846```
1847int(* OH_VObject::destroy) (OH_VObject *valueObject)
1848```
1849
1850**Description**
1851
1852Destroys an [OH_VObject](_o_h___v_object.md) object to reclaim the memory occupied.
1853
1854**Since**: 10
1855
1856**Parameters**
1857
1858| Name| Description|
1859| -------- | -------- |
1860| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.|
1861
1862**Returns**
1863
1864Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
1865
1866**See**
1867
1868[OH_VObject](_o_h___v_object.md).
1869
1870
1871### distinct
1872
1873```
1874OH_Predicates*(* OH_Predicates::distinct) (OH_Predicates *predicates)
1875```
1876
1877**Description**
1878
1879Pointer to the function used to set a predicates object to filter out duplicate records.
1880
1881This method is equivalent to **DISTINCT** in SQL statements.
1882
1883**Since**: 10
1884
1885**Parameters**
1886
1887| Name| Description|
1888| -------- | -------- |
1889| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
1890
1891**Returns**
1892
1893Returns the predicates created.
1894
1895**See**
1896
1897[OH_Predicates](_o_h___predicates.md).
1898
1899
1900### download
1901
1902```
1903Rdb_Statistic Rdb_TableDetails::download
1904```
1905
1906**Description**
1907
1908Statistics of the device-cloud download tasks.
1909
1910
1911### endWrap
1912
1913```
1914OH_Predicates*(* OH_Predicates::endWrap) (OH_Predicates *predicates)
1915```
1916
1917**Description**
1918
1919Pointer to the function used to add a right parenthesis to the predicates.
1920
1921This method is equivalent to ")" in SQL statements.
1922
1923**Since**: 10
1924
1925**Parameters**
1926
1927| Name| Description|
1928| -------- | -------- |
1929| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
1930
1931**Returns**
1932
1933Returns the predicates object with a right parenthesis.
1934
1935**See**
1936
1937[OH_Predicates](_o_h___predicates.md).
1938
1939
1940### equalTo
1941
1942```
1943OH_Predicates*(* OH_Predicates::equalTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
1944```
1945
1946**Description**
1947
1948Pointer to the function used to set a predicates object to match the field whose value is equal to the specified value.
1949
1950This method is equivalent to "=" in SQL statements.
1951
1952**Since**: 10
1953
1954**Parameters**
1955
1956| Name| Description|
1957| -------- | -------- |
1958| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
1959| field | Pointer to the column name in the database table.|
1960| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.|
1961
1962**Returns**
1963
1964Returns the predicates created.
1965
1966**See**
1967
1968[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
1969
1970
1971### failed
1972
1973```
1974int Rdb_Statistic::failed
1975```
1976
1977**Description**
1978
1979Number of rows that failed to be synchronized between the device and cloud in the database table.
1980
1981
1982### getAsset
1983
1984```
1985int(* OH_Cursor::getAsset) (OH_Cursor *cursor, int32_t columnIndex, Data_Asset *value)
1986```
1987
1988**Description**
1989
1990Pointer to the function used to obtain the value of the asset type based on the specified column and the current row.
1991
1992**Since**: 11
1993
1994**Parameters**
1995
1996| Name| Description|
1997| -------- | -------- |
1998| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
1999| columnIndex | Column index.|
2000| value | Pointer to the value obtained.|
2001
2002**Returns**
2003
2004Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2005
2006**See**
2007
2008[OH_Cursor](_o_h___cursor.md).
2009
2010
2011### getAssets
2012
2013```
2014int(* OH_Cursor::getAssets) (OH_Cursor *cursor, int32_t columnIndex, Data_Asset **value, uint32_t length)
2015```
2016
2017**Description**
2018
2019Pointer to the function used to obtain the values in the form of an asset array based on the specified column and the current row.
2020
2021**Since**: 11
2022
2023**Parameters**
2024
2025| Name| Description|
2026| -------- | -------- |
2027| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2028| columnIndex | Column index.|
2029| value | Pointer to the value obtained.|
2030| length | Length of an asset array.|
2031
2032**Returns**
2033
2034Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2035
2036**See**
2037
2038[OH_Cursor](_o_h___cursor.md).
2039
2040
2041### getBlob
2042
2043```
2044int(* OH_Cursor::getBlob) (OH_Cursor *cursor, int32_t columnIndex, unsigned char *value, int length)
2045```
2046
2047**Description**
2048
2049Pointer to the function used to obtain the values in the form of a byte array based on the specified column and the current row.
2050
2051**Since**: 10
2052
2053**Parameters**
2054
2055| Name| Description|
2056| -------- | -------- |
2057| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2058| columnIndex | Column index.|
2059| value | Pointer to the values in the form of a byte array obtained.|
2060| length | Length of the value, which can be obtained by **getSize()**.|
2061
2062**Returns**
2063
2064Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2065
2066**See**
2067
2068[OH_Cursor](_o_h___cursor.md).
2069
2070
2071### getColumnCount
2072
2073```
2074int(* OH_Cursor::getColumnCount) (OH_Cursor *cursor, int *count)
2075```
2076
2077**Description**
2078
2079Pointer to the function used to obtain the number of columns in the result set.
2080
2081**Since**: 10
2082
2083**Parameters**
2084
2085| Name| Description|
2086| -------- | -------- |
2087| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2088| count | Pointer to the number of columns in the result set obtained.|
2089
2090**Returns**
2091
2092Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2093
2094**See**
2095
2096[OH_Cursor](_o_h___cursor.md).
2097
2098
2099### getColumnIndex
2100
2101```
2102int(* OH_Cursor::getColumnIndex) (OH_Cursor *cursor, const char *name, int *columnIndex)
2103```
2104
2105**Description**
2106
2107Pointer to the function used to obtain the column index based on the specified column name.
2108
2109**Since**: 10
2110
2111**Parameters**
2112
2113| Name| Description|
2114| -------- | -------- |
2115| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2116| name | Pointer to the column name in the result set.|
2117| columnIndex | Pointer to the column index obtained.|
2118
2119**Returns**
2120
2121Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2122
2123**See**
2124
2125[OH_Cursor](_o_h___cursor.md).
2126
2127
2128### getColumnName
2129
2130```
2131int(* OH_Cursor::getColumnName) (OH_Cursor *cursor, int32_t columnIndex, char *name, int length)
2132```
2133
2134**Description**
2135
2136Pointer to the function used to obtain the column name based on the specified column index.
2137
2138**Since**: 10
2139
2140**Parameters**
2141
2142| Name| Description|
2143| -------- | -------- |
2144| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2145| columnIndex | Column index.|
2146| name | Pointer to the column name obtained.|
2147| length | Length of a column name.|
2148
2149**Returns**
2150
2151Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2152
2153**See**
2154
2155[OH_Cursor](_o_h___cursor.md).
2156
2157
2158### getColumnType
2159
2160```
2161int(* OH_Cursor::getColumnType) (OH_Cursor *cursor, int32_t columnIndex, OH_ColumnType *columnType)
2162```
2163
2164**Description**
2165
2166Pointer to the function used to obtain the column type based on the specified column index.
2167
2168**Since**: 10
2169
2170**Parameters**
2171
2172| Name| Description|
2173| -------- | -------- |
2174| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2175| columnIndex | Column index.|
2176| columnType | Pointer to the [OH_ColumnType](#oh_columntype) obtained.|
2177
2178**Returns**
2179
2180Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2181
2182**See**
2183
2184[OH_Cursor](_o_h___cursor.md), [OH_ColumnType](#oh_columntype).
2185
2186
2187### getInt64
2188
2189```
2190int(* OH_Cursor::getInt64) (OH_Cursor *cursor, int32_t columnIndex, int64_t *value)
2191```
2192
2193**Description**
2194
2195Pointer to the function used to obtain the value of the int64_t type based on the specified column and the current row.
2196
2197**Since**: 10
2198
2199**Parameters**
2200
2201| Name| Description|
2202| -------- | -------- |
2203| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2204| columnIndex | Column index.|
2205| value | Pointer to the value obtained.|
2206
2207**Returns**
2208
2209Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2210
2211**See**
2212
2213[OH_Cursor](_o_h___cursor.md).
2214
2215
2216### getReal
2217
2218```
2219int(* OH_Cursor::getReal) (OH_Cursor *cursor, int32_t columnIndex, double *value)
2220```
2221
2222**Description**
2223
2224Pointer to the function used to obtain the value of the double type based on the specified column and the current row.
2225
2226**Since**: 10
2227
2228**Parameters**
2229
2230| Name| Description|
2231| -------- | -------- |
2232| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2233| columnIndex | Column index.|
2234| value | Pointer to the value obtained.|
2235
2236**Returns**
2237
2238Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2239
2240**See**
2241
2242[OH_Cursor](_o_h___cursor.md).
2243
2244
2245### getRowCount
2246
2247```
2248int(* OH_Cursor::getRowCount) (OH_Cursor *cursor, int *count)
2249```
2250
2251**Description**
2252
2253Pointer to the function used to obtain the number of rows in the result set.
2254
2255**Since**: 10
2256
2257**Parameters**
2258
2259| Name| Description|
2260| -------- | -------- |
2261| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2262| count | Pointer to the number of columns in the result set obtained.|
2263
2264**Returns**
2265
2266Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2267
2268**See**
2269
2270[OH_Cursor](_o_h___cursor.md).
2271
2272
2273### getSize
2274
2275```
2276int(* OH_Cursor::getSize) (OH_Cursor *cursor, int32_t columnIndex, size_t *size)
2277```
2278
2279**Description**
2280
2281Pointer to the function used to obtain information about the memory required when the column data type in the result set is **BLOB** or **TEXT**.
2282
2283**Since**: 10
2284
2285**Parameters**
2286
2287| Name| Description|
2288| -------- | -------- |
2289| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2290| columnIndex | Column index.|
2291| size | Pointer to the memory size obtained.|
2292
2293**Returns**
2294
2295Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2296
2297**See**
2298
2299[OH_Cursor](_o_h___cursor.md).
2300
2301
2302### getText
2303
2304```
2305int(* OH_Cursor::getText) (OH_Cursor *cursor, int32_t columnIndex, char *value, int length)
2306```
2307
2308**Description**
2309
2310Pointer to the function used to obtain the value of the string type based on the specified column and the current row.
2311
2312**Since**: 10
2313
2314**Parameters**
2315
2316| Name| Description|
2317| -------- | -------- |
2318| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2319| columnIndex | Column index.|
2320| value | Pointer to the value of the string type obtained.|
2321| length | Length of the value, which can be obtained by **getSize()**.|
2322
2323**Returns**
2324
2325Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2326
2327**See**
2328
2329[OH_Cursor](_o_h___cursor.md).
2330
2331
2332### goToNextRow
2333
2334```
2335int(* OH_Cursor::goToNextRow) (OH_Cursor *cursor)
2336```
2337
2338**Description**
2339
2340Pointer to the function used to go to the next row of the result set.
2341
2342**Since**: 10
2343
2344**Parameters**
2345
2346| Name| Description|
2347| -------- | -------- |
2348| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2349
2350**Returns**
2351
2352Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2353
2354**See**
2355
2356[OH_Cursor](_o_h___cursor.md).
2357
2358
2359### greaterThan
2360
2361```
2362OH_Predicates*(* OH_Predicates::greaterThan) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
2363```
2364
2365**Description**
2366
2367Pointer to the function used to set a predicates object to match the field with value greater than the specified value.
2368
2369This method is equivalent to "&gt;" in SQL statements.
2370
2371**Since**: 10
2372
2373**Parameters**
2374
2375| Name| Description|
2376| -------- | -------- |
2377| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2378| field | Pointer to the column name in the database table.|
2379| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.|
2380
2381**Returns**
2382
2383Returns the predicates created.
2384
2385**See**
2386
2387[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
2388
2389
2390### greaterThanOrEqualTo
2391
2392```
2393OH_Predicates*(* OH_Predicates::greaterThanOrEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
2394```
2395
2396**Description**
2397
2398Pointer to the function used to set a predicates object to match the field with value greater than or equal to the specified value.
2399
2400This method is equivalent to "&gt;=" in SQL statements.
2401
2402**Since**: 10
2403
2404**Parameters**
2405
2406| Name| Description|
2407| -------- | -------- |
2408| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2409| field | Pointer to the column name in the database table.|
2410| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.|
2411
2412**Returns**
2413
2414Returns the predicates created.
2415
2416**See**
2417
2418[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
2419
2420
2421### groupBy
2422
2423```
2424OH_Predicates*(* OH_Predicates::groupBy) (OH_Predicates *predicates, char const *const *fields, int length)
2425```
2426
2427**Description**
2428
2429Pointer to the function used to set a predicates object to group rows that have the same value into summary rows.
2430
2431This method is equivalent to **GROUP BY** in SQL statements.
2432
2433**Since**: 10
2434
2435**Parameters**
2436
2437| Name| Description|
2438| -------- | -------- |
2439| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2440| fields | Pointer to the names of the columns by which the records are grouped.|
2441| length | Length of the **fields** value.|
2442
2443**Returns**
2444
2445Returns the predicates created.
2446
2447**See**
2448
2449[OH_Predicates](_o_h___predicates.md).
2450
2451
2452### id [1/4]
2453
2454```
2455int64_t OH_Predicates::id
2456```
2457
2458**Description**
2459
2460Unique identifier of the **OH_Predicates** struct.
2461
2462
2463### id [2/4]
2464
2465```
2466int64_t OH_VObject::id
2467```
2468
2469**Description**
2470
2471Unique identifier of the **OH_VObject** struct.
2472
2473
2474### id [3/4]
2475
2476```
2477int64_t OH_VBucket::id
2478```
2479
2480**Description**
2481
2482Unique identifier of the **OH_VBucket** struct.
2483
2484
2485### id [4/4]
2486
2487```
2488int64_t OH_Rdb_Store::id
2489```
2490
2491**Description**
2492
2493Unique identifier of the **OH_Rdb_Store** struct.
2494
2495
2496### in
2497
2498```
2499OH_Predicates*(* OH_Predicates::in) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
2500```
2501
2502**Description**
2503
2504Pointer to the function used to set a predicates object to match the field with the value within the specified range.
2505
2506This method is equivalent to **IN** in SQL statements.
2507
2508**Since**: 10
2509
2510**Parameters**
2511
2512| Name| Description|
2513| -------- | -------- |
2514| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2515| field | Pointer to the column name in the database table.|
2516| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value range.|
2517
2518**Returns**
2519
2520Returns the predicates created.
2521
2522**See**
2523
2524[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
2525
2526
2527### inserted
2528
2529```
2530Rdb_KeyInfo Rdb_ChangeInfo::inserted
2531```
2532
2533**Description**
2534
2535Location where data is inserted. If the primary key of the table is of the string type, the value is the value of the primary key. Otherwise, the value is the row number of the inserted data.
2536
2537
2538### integer
2539
2540```
2541uint64_t Rdb_KeyInfo::Rdb_KeyData::integer
2542```
2543
2544**Description**
2545
2546Data of the uint64_t type.
2547
2548
2549### isAutoSync
2550
2551```
2552bool Rdb_DistributedConfig::isAutoSync
2553```
2554
2555**Description**
2556
2557Whether the table supports automatic synchronization.
2558
2559
2560### isEncrypt
2561
2562```
2563bool OH_Rdb_Config::isEncrypt
2564```
2565
2566**Description**
2567
2568Whether to encrypt the RDB store.
2569
2570
2571### isNotNull
2572
2573```
2574OH_Predicates*(* OH_Predicates::isNotNull) (OH_Predicates *predicates, const char *field)
2575```
2576
2577**Description**
2578
2579Pointer to the function used to set a predicates object to match the field whose value is not null.
2580
2581This method is equivalent to **IS NOT NULL** in SQL statements.
2582
2583**Since**: 10
2584
2585**Parameters**
2586
2587| Name| Description|
2588| -------- | -------- |
2589| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2590| field | Pointer to the column name in the database table.|
2591
2592**Returns**
2593
2594Returns the predicates created.
2595
2596**See**
2597
2598[OH_Predicates](_o_h___predicates.md).
2599
2600
2601### isNull [1/2]
2602
2603```
2604int(* OH_Cursor::isNull) (OH_Cursor *cursor, int32_t columnIndex, bool *isNull)
2605```
2606
2607**Description**
2608
2609Pointer to the function used to check whether the value in the specified column is null.
2610
2611**Since**: 10
2612
2613**Parameters**
2614
2615| Name| Description|
2616| -------- | -------- |
2617| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.|
2618| columnIndex | Column index.|
2619| isNull | Pointer to the value returned. The value **true** means the value is null; the value **false** means the opposite.|
2620
2621**Returns**
2622
2623Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
2624
2625**See**
2626
2627[OH_Cursor](_o_h___cursor.md).
2628
2629
2630### isNull [2/2]
2631
2632```
2633OH_Predicates*(* OH_Predicates::isNull) (OH_Predicates *predicates, const char *field)
2634```
2635
2636**Description**
2637
2638Pointer to the function used to set a predicates object to match the field whose value is null.
2639
2640This method is equivalent to **IS NULL** in SQL statements.
2641
2642**Since**: 10
2643
2644**Parameters**
2645
2646| Name| Description|
2647| -------- | -------- |
2648| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2649| field | Pointer to the column name in the database table.|
2650
2651**Returns**
2652
2653Returns the predicates created.
2654
2655**See**
2656
2657[OH_Predicates](_o_h___predicates.md).
2658
2659
2660### lessThan
2661
2662```
2663OH_Predicates*(* OH_Predicates::lessThan) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
2664```
2665
2666**Description**
2667
2668Pointer to the function used to set a predicates object to match the field with value less than the specified value.
2669
2670This method is equivalent to "&lt;" in SQL statements.
2671
2672**Since**: 10
2673
2674**Parameters**
2675
2676| Name| Description|
2677| -------- | -------- |
2678| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2679| field | Pointer to the column name in the database table.|
2680| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.|
2681
2682**Returns**
2683
2684Returns the predicates created.
2685
2686**See**
2687
2688[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
2689
2690
2691### lessThanOrEqualTo
2692
2693```
2694OH_Predicates*(* OH_Predicates::lessThanOrEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
2695```
2696
2697**Description**
2698
2699Pointer to the function used to set a predicates object to match the field with value less than or equal to the specified value.
2700
2701This method is equivalent to "&lt;=" in SQL statements.
2702
2703**Since**: 10
2704
2705**Parameters**
2706
2707| Name| Description|
2708| -------- | -------- |
2709| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2710| field | Pointer to the column name in the database table.|
2711| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.|
2712
2713**Returns**
2714
2715Returns the predicates created.
2716
2717**See**
2718
2719[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
2720
2721
2722### like
2723
2724```
2725OH_Predicates*(* OH_Predicates::like) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
2726```
2727
2728**Description**
2729
2730Pointer to the function used to set a predicates object to match a string that is similar to the specified value.
2731
2732This method is equivalent to **LIKE** in SQL statements.
2733
2734**Since**: 10
2735
2736**Parameters**
2737
2738| Name| Description|
2739| -------- | -------- |
2740| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2741| field | Pointer to the column name in the database table.|
2742| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.|
2743
2744**Returns**
2745
2746Returns the predicates created.
2747
2748**See**
2749
2750[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
2751
2752
2753### limit
2754
2755```
2756OH_Predicates*(* OH_Predicates::limit) (OH_Predicates *predicates, unsigned int value)
2757```
2758
2759**Description**
2760
2761Pointer to the function used to set a predicates object to specify the maximum number of records.
2762
2763This method is equivalent to **LIMIT** in SQL statements.
2764
2765**Since**: 10
2766
2767**Parameters**
2768
2769| Name| Description|
2770| -------- | -------- |
2771| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2772| value | Maximum number of data records.|
2773
2774**Returns**
2775
2776Returns the predicates created.
2777
2778**See**
2779
2780[OH_Predicates](_o_h___predicates.md).
2781
2782
2783### moduleName
2784
2785```
2786const char* OH_Rdb_Config::moduleName
2787```
2788
2789**Description**
2790
2791Module name.
2792
2793
2794### notBetween
2795
2796```
2797OH_Predicates*(* OH_Predicates::notBetween) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
2798```
2799
2800**Description**
2801
2802Pointer to the function used to set a predicates object to match the field whose value is out of the specified range.
2803
2804This method is equivalent to **NOT BETWEEN** in SQL statements.
2805
2806**Since**: 10
2807
2808**Parameters**
2809
2810| Name| Description|
2811| -------- | -------- |
2812| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2813| field | Pointer to the column name in the database table.|
2814| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.|
2815
2816**Returns**
2817
2818Returns the predicates created.
2819
2820**See**
2821
2822[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
2823
2824
2825### notEqualTo
2826
2827```
2828OH_Predicates*(* OH_Predicates::notEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
2829```
2830
2831**Description**
2832
2833Pointer to the function used to set a predicates object to match the field whose value is not equal to the specified value.
2834
2835This method is equivalent to "!=" in SQL statements.
2836
2837**Since**: 10
2838
2839**Parameters**
2840
2841| Name| Description|
2842| -------- | -------- |
2843| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2844| field | Pointer to the column name in the database table.|
2845| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.|
2846
2847**Returns**
2848
2849Returns the predicates created.
2850
2851**See**
2852
2853[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
2854
2855
2856### notIn
2857
2858```
2859OH_Predicates*(* OH_Predicates::notIn) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)
2860```
2861
2862**Description**
2863
2864Pointer to the function used to set a predicates object to match the field with the value out of the specified range.
2865
2866This method is equivalent to **NOT IN** in SQL statements.
2867
2868**Since**: 10
2869
2870**Parameters**
2871
2872| Name| Description|
2873| -------- | -------- |
2874| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2875| field | Pointer to the column name in the database table.|
2876| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value range to match.|
2877
2878**Returns**
2879
2880Returns the predicates created.
2881
2882**See**
2883
2884[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md).
2885
2886
2887### offset
2888
2889```
2890OH_Predicates*(* OH_Predicates::offset) (OH_Predicates *predicates, unsigned int rowOffset)
2891```
2892
2893**Description**
2894
2895Pointer to the function used to set a predicates object to specify the start position of the returned result.
2896
2897This method is equivalent to **OFFSET** in SQL statements.
2898
2899**Since**: 10
2900
2901**Parameters**
2902
2903| Name| Description|
2904| -------- | -------- |
2905| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2906| rowOffset | Start position of the returned result. The value is a positive integer.|
2907
2908**Returns**
2909
2910Returns the predicates created.
2911
2912**See**
2913
2914[OH_Predicates](_o_h___predicates.md).
2915
2916
2917### orderBy
2918
2919```
2920OH_Predicates*(* OH_Predicates::orderBy) (OH_Predicates *predicates, const char *field, OH_OrderType type)
2921```
2922
2923**Description**
2924
2925Pointer to the function used to set a predicates object to sort the values in a column in ascending or descending order.
2926
2927This method is equivalent to **ORDER BY** in SQL statements.
2928
2929**Since**: 10
2930
2931**Parameters**
2932
2933| Name| Description|
2934| -------- | -------- |
2935| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2936| field | Pointer to the column name in the database table.|
2937| type | Sorting type [OH_OrderType](#oh_ordertype).|
2938
2939**Returns**
2940
2941Returns the predicates created.
2942
2943**See**
2944
2945[OH_Predicates](_o_h___predicates.md), [OH_OrderType](#oh_ordertype).
2946
2947
2948### orOperate
2949
2950```
2951OH_Predicates*(* OH_Predicates::orOperate) (OH_Predicates *predicates)
2952```
2953
2954**Description**
2955
2956Pointer to the function used to add the OR operator to the predicates.
2957
2958This method is equivalent to **OR** in SQL statements.
2959
2960**Since**: 10
2961
2962**Parameters**
2963
2964| Name| Description|
2965| -------- | -------- |
2966| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.|
2967
2968**Returns**
2969
2970Returns the predicates with the OR operator.
2971
2972**See**
2973
2974[OH_Predicates](_o_h___predicates.md).
2975
2976
2977### putBlob
2978
2979```
2980int(* OH_VBucket::putBlob) (OH_VBucket *bucket, const char *field, const uint8_t *value, uint32_t size)
2981```
2982
2983**Description**
2984
2985Puts a const uint8_t value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.
2986
2987**Since**: 10
2988
2989**Parameters**
2990
2991| Name| Description|
2992| -------- | -------- |
2993| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
2994| field | Pointer to the column name in the database table.|
2995| value | Pointer to the value to put.|
2996| size | Length of the value.|
2997
2998**Returns**
2999
3000Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
3001
3002**See**
3003
3004[OH_VBucket](_o_h___v_bucket.md).
3005
3006
3007### putDouble
3008
3009```
3010int(* OH_VObject::putDouble) (OH_VObject *valueObject, double *value, uint32_t count)
3011```
3012
3013**Description**
3014
3015Converts a single parameter or an array of the double type into a value of the [OH_VObject](_o_h___v_object.md) type.
3016
3017**Since**: 10
3018
3019**Parameters**
3020
3021| Name| Description|
3022| -------- | -------- |
3023| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.|
3024| value | Pointer to the data to covert.|
3025| count | If **value** points to a single parameter, **count** is **1**. If **value** points to an array, **count** specifies the length of the array.|
3026
3027**Returns**
3028
3029Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
3030
3031**See**
3032
3033[OH_VObject](_o_h___v_object.md).
3034
3035
3036### putInt64 [1/2]
3037
3038```
3039int(* OH_VBucket::putInt64) (OH_VBucket *bucket, const char *field, int64_t value)
3040```
3041
3042**Description**
3043
3044Puts an int64_t value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.
3045
3046**Since**: 10
3047
3048**Parameters**
3049
3050| Name| Description|
3051| -------- | -------- |
3052| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
3053| field | Pointer to the column name in the database table.|
3054| value | Pointer to the value to put.|
3055
3056**Returns**
3057
3058Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
3059
3060**See**
3061
3062[OH_VBucket](_o_h___v_bucket.md).
3063
3064
3065### putInt64 [2/2]
3066
3067```
3068int(* OH_VObject::putInt64) (OH_VObject *valueObject, int64_t *value, uint32_t count)
3069```
3070
3071**Description**
3072
3073Converts a single parameter or an array of the int64 type into a value of the [OH_VObject](_o_h___v_object.md) type.
3074
3075**Since**: 10
3076
3077**Parameters**
3078
3079| Name| Description|
3080| -------- | -------- |
3081| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.|
3082| value | Pointer to the data to covert.|
3083| count | If **value** points to a single parameter, **count** is **1**. If **value** points to an array, **count** specifies the length of the array.|
3084
3085**Returns**
3086
3087Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
3088
3089**See**
3090
3091[OH_VObject](_o_h___v_object.md).
3092
3093
3094### putNull
3095
3096```
3097int(* OH_VBucket::putNull) (OH_VBucket *bucket, const char *field)
3098```
3099
3100**Description**
3101
3102Puts a null value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.
3103
3104**Since**: 10
3105
3106**Parameters**
3107
3108| Name| Description|
3109| -------- | -------- |
3110| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
3111| field | Pointer to the column name in the database table.|
3112
3113**Returns**
3114
3115Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
3116
3117**See**
3118
3119[OH_VBucket](_o_h___v_bucket.md).
3120
3121
3122### putReal
3123
3124```
3125int(* OH_VBucket::putReal) (OH_VBucket *bucket, const char *field, double value)
3126```
3127
3128**Description**
3129
3130Puts a double value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.
3131
3132**Since**: 10
3133
3134**Parameters**
3135
3136| Name| Description|
3137| -------- | -------- |
3138| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
3139| field | Pointer to the column name in the database table.|
3140| value | Pointer to the value to put.|
3141
3142**Returns**
3143
3144Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
3145
3146**See**
3147
3148[OH_VBucket](_o_h___v_bucket.md).
3149
3150
3151### putText [1/2]
3152
3153```
3154int(* OH_VBucket::putText) (OH_VBucket *bucket, const char *field, const char *value)
3155```
3156
3157**Description**
3158
3159Puts a char value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column.
3160
3161**Since**: 10
3162
3163**Parameters**
3164
3165| Name| Description|
3166| -------- | -------- |
3167| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.|
3168| field | Pointer to the column name in the database table.|
3169| value | Pointer to the value to put.|
3170
3171**Returns**
3172
3173Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
3174
3175**See**
3176
3177[OH_VBucket](_o_h___v_bucket.md).
3178
3179
3180### putText [2/2]
3181
3182```
3183int(* OH_VObject::putText) (OH_VObject *valueObject, const char *value)
3184```
3185
3186**Description**
3187
3188Converts a character array of the char type to a value of the [OH_VObject](_o_h___v_object.md) type.
3189
3190**Since**: 10
3191
3192**Parameters**
3193
3194| Name| Description|
3195| -------- | -------- |
3196| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.|
3197| value | Pointer to the character array to convert.|
3198
3199**Returns**
3200
3201Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
3202
3203**See**
3204
3205[OH_VObject](_o_h___v_object.md).
3206
3207
3208### putTexts
3209
3210```
3211int(* OH_VObject::putTexts) (OH_VObject *valueObject, const char **value, uint32_t count)
3212```
3213
3214**Description**
3215
3216Converts a string array of the char type to a value of the [OH_VObject](_o_h___v_object.md) type.
3217
3218**Since**: 10
3219
3220**Parameters**
3221
3222| Name| Description|
3223| -------- | -------- |
3224| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.|
3225| value | Pointer to the string array to convert.|
3226| count | Length of the string array to convert.|
3227
3228**Returns**
3229
3230Returns **RDB_OK** if the operation is successful; returns an error code otherwise.
3231
3232**See**
3233
3234[OH_VObject](_o_h___v_object.md).
3235
3236
3237### real
3238
3239```
3240double Rdb_KeyInfo::Rdb_KeyData::real
3241```
3242
3243**Description**
3244
3245Data of the double type.
3246
3247
3248### remained
3249
3250```
3251int Rdb_Statistic::remained
3252```
3253
3254**Description**
3255
3256Number of rows that are not executed for device-cloud synchronization in the database table.
3257
3258
3259### schedule
3260
3261```
3262int Rdb_ProgressDetails::schedule
3263```
3264
3265**Description**
3266
3267Device-cloud synchronization process.
3268
3269
3270### securityLevel
3271
3272```
3273int OH_Rdb_Config::securityLevel
3274```
3275
3276**Description**
3277
3278RDB store security level. For details, see [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel).
3279
3280
3281### selfSize
3282
3283```
3284int OH_Rdb_Config::selfSize
3285```
3286
3287**Description**
3288
3289Size of the struct.
3290
3291
3292### storeName
3293
3294```
3295const char* OH_Rdb_Config::storeName
3296```
3297
3298**Description**
3299
3300Name of the RDB store.
3301
3302
3303### successful
3304
3305```
3306int Rdb_Statistic::successful
3307```
3308
3309**Description**
3310
3311Number of rows that are successfully synchronized between the device and cloud in the database table.
3312
3313
3314### table
3315
3316```
3317const char* Rdb_TableDetails::table
3318```
3319
3320**Description**
3321
3322Database table name.
3323
3324
3325### tableLength
3326
3327```
3328int32_t Rdb_ProgressDetails::tableLength
3329```
3330
3331**Description**
3332
3333Number of the tables synchronized between the device and cloud.
3334
3335
3336### tableName
3337
3338```
3339const char* Rdb_ChangeInfo::tableName
3340```
3341
3342**Description**
3343
3344Name of the table with data changes.
3345
3346
3347### text
3348
3349```
3350const char* Rdb_KeyInfo::Rdb_KeyData::text
3351```
3352
3353**Description**
3354
3355Data of the char \* type.
3356
3357
3358### total
3359
3360```
3361int Rdb_Statistic::total
3362```
3363
3364**Description**
3365
3366Total number of rows to be synchronized between the device and cloud in the database table.
3367
3368
3369### type
3370
3371```
3372int Rdb_KeyInfo::type
3373```
3374
3375**Description**
3376
3377Type ([OH_ColumnType](#oh_columntype)) of the primary key.
3378
3379
3380### updated
3381
3382```
3383Rdb_KeyInfo Rdb_ChangeInfo::updated
3384```
3385
3386**Description**
3387
3388Location where data is updated. If the primary key of the table is of the string type, the value is the value of the primary key. Otherwise, the value is the row number of the updated data.
3389
3390
3391### upload
3392
3393```
3394Rdb_Statistic Rdb_TableDetails::upload
3395```
3396
3397**Description**
3398
3399Statistics of the device-cloud upload tasks.
3400
3401
3402### version [1/3]
3403
3404```
3405int Rdb_DistributedConfig::version
3406```
3407
3408**Description**
3409
3410Version of the **Rdb_DistributedConfig** struct.
3411
3412
3413### version [2/3]
3414
3415```
3416int Rdb_ChangeInfo::version
3417```
3418
3419**Description**
3420
3421Version of the **Rdb_DistributedConfig** struct.
3422
3423
3424### version [3/3]
3425
3426```
3427int Rdb_ProgressDetails::version
3428```
3429
3430**Description**
3431
3432Version of the **OH_TableDetails** struct.
3433