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) | Defines APIs for accessing the result set obtained by querying the RDB store.<br>**File to include**: <database/rdb/oh_cursor.h><br>**Library**: libnative_rdb_ndk.z.so<br>| 21| [oh_predicates.h](oh__predicates_8h.md) | Defines the predicates for RDB stores.<br>**File to include**: <database/rdb/oh_predicates.h><br>**Library**: libnative_rdb_ndk.z.so<br>| 22| [oh_value_object.h](oh__value__object_8h.md) | Defines the APIs for type conversion.<br>**File to include**: <database/rdb/oh_value_object.h><br>**Library**: libnative_rdb_ndk.z.so<br>| 23| [oh_values_bucket.h](oh__values__bucket_8h.md) | Defines the types of the key and value in a key-value (KV) pair.<br>**File to include**: <database/rdb/oh_values_bucket.h><br>**Library**: libnative_rdb_ndk.z.so<br>| 24| [relational_store.h](relational__store_8h.md) | Defines APIs for managing an RDB store.<br>**File to include**: <database/rdb/relational_store.h><br>**Library**: libnative_rdb_ndk.z.so<br>| 25| [relational_store_error_code.h](relational__store__error__code_8h.md) | Defines the error codes used for RDB stores.<br>**File to include**: <database/rdb/relational_store_error_code.h><br>**Library**: libnative_rdb_ndk.z.so| 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 sync process.| 42| [Rdb_SubscribeCallback](union_rdb___subscribe_callback.md) | Defines a callback used to return the subscribed event.| 43| [Rdb_DataObserver](_rdb___data_observer.md) | Defines the data observer.| 44| [Rdb_Statistic](_rdb___statistic.md) | Defines the device-cloud sync statistics of a database table.| 45| [Rdb_TableDetails](_rdb___table_details.md) | Defines the statistics of device-cloud upload and download tasks of a database table.| 46| [Rdb_ProgressDetails](_rdb___progress_details.md) | Defines the statistics of the overall device-cloud sync (upload and download) tasks of an RDB store.| 47| [Rdb_ProgressObserver](_rdb___progress_observer.md) | Defines the observer of the device-cloud sync progress.| 48 49 50### Macros 51 52| Name| Description| 53| -------- | -------- | 54| [DISTRIBUTED_CONFIG_VERSION](#distributed_config_version) 1 | Version of [Rdb_DistributedConfig](_rdb___distributed_config.md).| 55| [DISTRIBUTED_CHANGE_INFO_VERSION](#distributed_change_info_version) 1 | Version of [Rdb_ChangeInfo](_rdb___change_info.md).| 56| [DISTRIBUTED_PROGRESS_DETAIL_VERSION](#distributed_progress_detail_version) 1 | Version of [Rdb_ProgressDetails](_rdb___progress_details.md).| 57 58 59### Types 60 61| Name| Description| 62| -------- | -------- | 63| typedef struct [OH_Rdb_ConfigV2](#oh_rdb_configv2) [OH_Rdb_ConfigV2](#oh_rdb_configv2) | Defines a struct for the RDB store configuration. Different from [OH_Rdb_Config](_o_h___rdb___config.md), this struct does not expose its member variables externally. Methods are used to configure the properties of this struct.| 64| typedef enum [Rdb_DBType](#rdb_dbtype) [Rdb_DBType](#rdb_dbtype) | Defines an enum for database kernel types.| 65| [OH_ColumnType](#oh_columntype) | Defines an enum for the field types in an RDB store.| 66| [OH_Cursor](#oh_cursor) | Defines a struct for a result set.| 67| [OH_OrderType](#oh_ordertype) | Defines an enum for sorting types.| 68| [OH_Predicates](#oh_predicates) | Defines a **predicates** object.| 69| [OH_VObject](#oh_vobject) | Defines a struct for allowed data field types.| 70| [OH_VBucket](#oh_vbucket) | Defines a struct for the types of the key and value in a KV pair.| 71| [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel) | Defines an enum for RDB store security levels.| 72| [Rdb_SecurityArea](#rdb_securityarea) | Defines an enum for security area levels of an RDB store.| 73| [Rdb_DistributedType](#rdb_distributedtype) | Defines an enum for distributed types.| 74| [Rdb_DistributedConfig](#rdb_distributedconfig) | Defines a struct for distributed configuration of a table.| 75| [Rdb_ChangeType](#rdb_changetype) | Defines an enum for data change types.| 76| [Rdb_KeyInfo](#rdb_keyinfo) | Defines a struct for the primary key or row number of the row that changes.| 77| [Rdb_ChangeInfo](#rdb_changeinfo) | Defines a struct for the details about the device-cloud sync process.| 78| [Rdb_SubscribeType](#rdb_subscribetype) | Defines an enum for subscription types.| 79| [Rdb_BriefObserver](#rdb_briefobserver) | Defines a callback used to return the device-cloud data change event.| 80| [Rdb_DetailsObserver](#rdb_detailsobserver) | Defines a callback used to return the details about the device-cloud data change.| 81| [Rdb_SubscribeCallback](#rdb_subscribecallback) | Defines a callback used to return the subscribed event.| 82| [Rdb_DataObserver](#rdb_dataobserver) | Defines a struct for the data observer.| 83| [Rdb_SyncMode](#rdb_syncmode) | Defines an enum for RDB store sync modes.| 84| [Rdb_Statistic](#rdb_statistic) | Defines a struct for the device-cloud sync statistics of a database table.| 85| [Rdb_TableDetails](#rdb_tabledetails) | Defines a struct for statistics of device-cloud upload and download tasks of a database table.| 86| [Rdb_Progress](#rdb_progress) | Defines an enum for device-cloud sync progresses.| 87| [Rdb_ProgressCode](#rdb_progresscode) | Defines an enum for device-cloud sync states.| 88| [Rdb_ProgressDetails](#rdb_progressdetails) | Defines a struct for statistics of the overall device-cloud sync (upload and download) tasks of an RDB store.| 89| [Rdb_ProgressCallback](#rdb_progresscallback) | Defines a callback used to return the device-cloud sync progress.| 90| [Rdb_SyncCallback](#rdb_synccallback) | Defines a callback for device-cloud sync.| 91| [Rdb_ProgressObserver](#rdb_progressobserver) | Defines the observer of the device-cloud sync progress.| 92| [OH_Rdb_ErrCode](#oh_rdb_errcode) | Defines an enum for error codes.| 93 94 95### Enums 96 97| Name| Description| 98| -------- | -------- | 99| [Rdb_DBType](#rdb_dbtype-1) { RDB_SQLITE = 1, RDB_CAYLEY = 2, DBTYPE_BUTT = 64 } | Enumerates the database kernel types.| 100| [OH_ColumnType](#oh_columntype-1) {<br>TYPE_NULL = 0, TYPE_INT64, TYPE_REAL, TYPE_TEXT,<br>TYPE_BLOB, TYPE_ASSET, TYPE_ASSETS<br>} | Enumerates the field types in an RDB store.| 101| [OH_OrderType](#oh_ordertype-1) { ASC = 0, DESC = 1 } | Enumerates the sorting types.| 102| [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel-1) { S1 = 1, S2, S3, S4 } | Enumerates the RDB store security levels.| 103| [Rdb_SecurityArea](#rdb_securityarea-1) { 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.| 104| [Rdb_DistributedType](#rdb_distributedtype-1) { RDB_DISTRIBUTED_CLOUD } | Enumerates the distributed types.| 105| [Rdb_ChangeType](#rdb_changetype-1) { RDB_DATA_CHANGE, RDB_ASSET_CHANGE } | Enumerates the data change types.| 106| [Rdb_SubscribeType](#rdb_subscribetype-1) { RDB_SUBSCRIBE_TYPE_CLOUD, RDB_SUBSCRIBE_TYPE_CLOUD_DETAILS, RDB_SUBSCRIBE_TYPE_LOCAL_DETAILS } | Enumerates the subscription types.| 107| [Rdb_SyncMode](#rdb_syncmode-1) { RDB_SYNC_MODE_TIME_FIRST, RDB_SYNC_MODE_NATIVE_FIRST, RDB_SYNC_MODE_CLOUD_FIRST } | Enumerates the RDB store sync modes. | 108| [Rdb_Progress](#rdb_progress-1) { RDB_SYNC_BEGIN, RDB_SYNC_IN_PROGRESS, RDB_SYNC_FINISH } | Enumerates the device-cloud sync progresses.| 109| [Rdb_ProgressCode](#rdb_progresscode-1) {<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 sync states.| 110| [OH_Rdb_ErrCode](#oh_rdb_errcode-1) {<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.| 111 112 113### Functions 114 115| Name| Description| 116| -------- | -------- | 117| [OH_Rdb_ConfigV2](#oh_rdb_configv2) \* [OH_Rdb_CreateConfig](#oh_rdb_createconfig) () | Creates an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 118| int [OH_Rdb_DestroyConfig](#oh_rdb_destroyconfig) ([OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config) | Destroys an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 119| int [OH_Rdb_SetDatabaseDir](#oh_rdb_setdatabasedir) ([OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config, const char \*databaseDir) | Sets the database file path for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 120| int [OH_Rdb_SetStoreName](#oh_rdb_setstorename) ([OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config, const char \*storeName) | Sets the RDB store name for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 121| int [OH_Rdb_SetBundleName](#oh_rdb_setbundlename) ([OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config, const char \*bundleName) | Sets the application bundle name for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 122| int [OH_Rdb_SetModuleName](#oh_rdb_setmodulename) ([OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config, const char \*moduleName) | Sets the module name for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 123| int [OH_Rdb_SetEncrypted](#oh_rdb_setencrypted) ([OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config, bool isEncrypted) | Sets whether to encrypt the RDB store for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 124| int [OH_Rdb_SetSecurityLevel](#oh_rdb_setsecuritylevel) ([OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config, int securityLevel) | Sets the RDB store security level ([OH_Rdb_SecurityLevel](#oh_rdb_securitylevel)) for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 125| int [OH_Rdb_SetArea](#oh_rdb_setarea) ([OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config, int area) | Sets the security area level ([Rdb_SecurityArea](#rdb_securityarea)) for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 126| int [OH_Rdb_SetDbType](#oh_rdb_setdbtype) ([OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config, int dbType) | Sets the database type ([Rdb_DBType](#rdb_dbtype)) for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance.| 127| const int \* [OH_Rdb_GetSupportedDbType](#oh_rdb_getsupporteddbtype) (int \*typeCount) | Obtains the supported database types ([Rdb_DBType](#rdb_dbtype)).| 128| [OH_Rdb_Store](_o_h___rdb___store.md) \* [OH_Rdb_CreateOrOpen](#oh_rdb_createoropen) (const [OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config, int \*errCode) | Creates or opens an [OH_Rdb_Store](_o_h___rdb___store.md) instance based on the given [OH_Rdb_ConfigV2](#oh_rdb_configv2).| 129| int [OH_Rdb_DeleteStoreV2](#oh_rdb_deletestorev2) (const [OH_Rdb_ConfigV2](#oh_rdb_configv2) \*config) | Deletes an RDB store based on the given [OH_Rdb_ConfigV2](#oh_rdb_configv2).| 130| int [OH_Rdb_ExecuteByTrxId](#oh_rdb_executebytrxid) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, int64_t trxId, const char \*sql) | Executes an SQL statement that returns no value based on the specified transaction ID.| 131| int [OH_Rdb_BeginTransWithTrxId](#oh_rdb_begintranswithtrxid) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, int64_t \*trxId) | Starts a transaction and obtains the transaction ID before executing an SQL statement.| 132| int [OH_Rdb_RollBackByTrxId](#oh_rdb_rollbackbytrxid) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, int64_t trxId) | Rolls back the executed SQL statement based on the specified transaction ID.| 133| int [OH_Rdb_CommitByTrxId](#oh_rdb_commitbytrxid) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, int64_t trxId) | Commits the executed SQL statement based on the specified transaction ID.| 134| [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.| 135| [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.| 136| [OH_Rdb_CreateValueObject](#oh_rdb_createvalueobject) () | Creates an [OH_VObject](_o_h___v_object.md) instance.| 137| [OH_Rdb_CreateValuesBucket](#oh_rdb_createvaluesbucket) () | Creates an [OH_VBucket](_o_h___v_bucket.md) instance.| 138| [OH_Rdb_CreatePredicates](#oh_rdb_createpredicates) (const char \*table) | Creates an [OH_Predicates](_o_h___predicates.md) instance.| 139| [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.| 140| [OH_Rdb_CloseStore](#oh_rdb_closestore) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Closes an [OH_Rdb_Store](_o_h___rdb___store.md) object to reclaim the memory occupied.| 141| [OH_Rdb_DeleteStore](#oh_rdb_deletestore) (const [OH_Rdb_Config](_o_h___rdb___config.md) \*config) | Deletes an RDB store with the specified configuration.| 142| [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.| 143| [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.| 144| [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.| 145| [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.| 146| [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.| 147| [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.| 148| [OH_Rdb_BeginTransaction](#oh_rdb_begintransaction) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Starts the transaction before executing the SQL statement.| 149| [OH_Rdb_RollBack](#oh_rdb_rollback) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Rolls back the SQL statement executed.| 150| [OH_Rdb_Commit](#oh_rdb_commit) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store) | Commits the executed SQL statement.| 151| [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.| 152| [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.| 153| [OH_Rdb_GetVersion](#oh_rdb_getversion) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, int \*version) | Obtains the RDB store version.| 154| [OH_Rdb_SetVersion](#oh_rdb_setversion) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, int version) | Sets the RDB store version.| 155| [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.| 156| [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.| 157| [OH_Rdb_Subscribe](#oh_rdb_subscribe) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [Rdb_SubscribeType](#rdb_subscribetype) type, const [Rdb_DataObserver](_rdb___data_observer.md) \*observer) | Registers an observer for an RDB store. When data in the RDB store changes, a callback will be invoked to return the data changes.| 158| [OH_Rdb_Unsubscribe](#oh_rdb_unsubscribe) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [Rdb_SubscribeType](#rdb_subscribetype) type, const [Rdb_DataObserver](_rdb___data_observer.md) \*observer) | Unregisters the observer of the specified type.| 159| [OH_Rdb_GetTableDetails](#oh_rdb_gettabledetails) ([Rdb_ProgressDetails](_rdb___progress_details.md) \*progress, int32_t version) | Obtains the device-cloud sync statistics of a table.| 160| [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, const [Rdb_ProgressObserver](_rdb___progress_observer.md) \*observer) | Performs device-cloud sync.| 161| [OH_Rdb_SubscribeAutoSyncProgress](#oh_rdb_subscribeautosyncprogress) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const [Rdb_ProgressObserver](_rdb___progress_observer.md) \*observer) | Subscribes to the automatic sync progress of an RDB store. The registered callback will be invoked to return the automatic sync progress.| 162| [OH_Rdb_UnsubscribeAutoSyncProgress](#oh_rdb_unsubscribeautosyncprogress) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, const [Rdb_ProgressObserver](_rdb___progress_observer.md) \*observer) | Unsubscribes from the automatic sync process of an RDB store.| 163| int [OH_Rdb_LockRow](#oh_rdb_lockrow) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_Predicates](_o_h___predicates.md) \*predicates) | Locks data in an RDB store based on specified conditions. The locked data will be blocked from the device-cloud sync.| 164| int [OH_Rdb_UnlockRow](#oh_rdb_unlockrow) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_Predicates](_o_h___predicates.md) \*predicates) | Unlocks data in an RDB store based on the specified conditions.| 165| [OH_Cursor](_o_h___cursor.md) \* [OH_Rdb_QueryLockedRow](#oh_rdb_querylockedrow) ([OH_Rdb_Store](_o_h___rdb___store.md) \*store, [OH_Predicates](_o_h___predicates.md) \*predicates, const char \*const \*columnNames, int length) | Queries the locked data in an RDB store.| 166 167### Variables 168 169| Name| Description| 170| -------- | -------- | 171| [OH_Cursor::id](#id-15) | Unique identifier of the **OH_Cursor** struct.| 172| [OH_Cursor::getColumnCount](#getcolumncount) | Pointer to the function used to obtain the number of columns in the result set.| 173| [OH_Cursor::getColumnType](#getcolumntype) | Pointer to the function used to obtain the column type based on the specified column index.| 174| [OH_Cursor::getColumnIndex](#getcolumnindex) | Pointer to the function used to obtain the column index based on the specified column name.| 175| [OH_Cursor::getColumnName](#getcolumnname) | Pointer to the function used to obtain the column name based on the specified column index.| 176| [OH_Cursor::getRowCount](#getrowcount) | Pointer to the function used to obtain the number of rows in the result set.| 177| [OH_Cursor::goToNextRow](#gotonextrow) | Pointer to the function used to go to the next row of the result set.| 178| [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**.| 179| [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.| 180| [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.| 181| [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.| 182| [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.| 183| [OH_Cursor::isNull](#isnull-12) | Pointer to the function used to check whether the value in the specified column is null.| 184| [OH_Cursor::destroy](#destroy-14) | Pointer to the function used to destroy a result set.| 185| [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.| 186| [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.| 187| [OH_Predicates::id](#id-25) | Unique identifier of the **OH_Predicates** struct.| 188| [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.| 189| [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.| 190| [OH_Predicates::beginWrap](#beginwrap) | Pointer to the function used to add a left parenthesis to the predicates.| 191| [OH_Predicates::endWrap](#endwrap) | Pointer to the function used to add a right parenthesis to the predicates.| 192| [OH_Predicates::orOperate](#oroperate) | Pointer to the function used to add the OR operator to the predicates.| 193| [OH_Predicates::andOperate](#andoperate) | Pointer to the function used to add the AND operator to the predicates.| 194| [OH_Predicates::isNull](#isnull-22) | Pointer to the function used to set a predicates object to match the field whose value is null.| 195| [OH_Predicates::isNotNull](#isnotnull) | Pointer to the function used to set a predicates object to match the field whose value is not null.| 196| [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.| 197| [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.| 198| [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.| 199| [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.| 200| [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.| 201| [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.| 202| [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.| 203| [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.| 204| [OH_Predicates::distinct](#distinct) | Pointer to the function used to set a predicates object to filter out duplicate records.| 205| [OH_Predicates::limit](#limit) | Pointer to the function used to set a predicates object to specify the maximum number of records.| 206| [OH_Predicates::offset](#offset) | Pointer to the function used to set a predicates object to specify the start position of the returned result.| 207| [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.| 208| [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.| 209| [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.| 210| [OH_Predicates::clear](#clear-12) | Pointer to the function used to clear a predicates instance.| 211| [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.| 212| [OH_VObject::id](#id-35) | Unique identifier of the **OH_VObject** struct.| 213| [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.| 214| [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.| 215| [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.| 216| [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.| 217| [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.| 218| [OH_VBucket::id](#id-45) | Unique identifier of the **OH_VBucket** struct.| 219| [OH_VBucket::capability](#capability) | Number of the KV pairs in the struct.| 220| [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.| 221| [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.| 222| [OH_VBucket::putReal](#putreal) | Pointer to the function used to put a double value into the {OH_VBucket} object in the given column.| 223| [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.| 224| [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.| 225| [OH_VBucket::clear](#clear-22) | Pointer to the function used to clear an [OH_VBucket](_o_h___v_bucket.md) object.| 226| [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.| 227| [OH_Rdb_Config::selfSize](#selfsize) | Size of the struct.| 228| [OH_Rdb_Config::dataBaseDir](#databasedir) | Path of the database file.| 229| [OH_Rdb_Config::storeName](#storename) | Name of the RDB store.| 230| [OH_Rdb_Config::bundleName](#bundlename) | Bundle name.| 231| [OH_Rdb_Config::moduleName](#modulename) | Module name. | 232| [OH_Rdb_Config::isEncrypt](#isencrypt) | Whether to encrypt the RDB store.| 233| [OH_Rdb_Config::securityLevel](#securitylevel) | RDB store security level. For details, see [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel).| 234| [OH_Rdb_Config::area](#area) | Security area level. For details, see [Rdb_SecurityArea](#rdb_securityarea).| 235| [OH_Rdb_Store::id](#id-55) | Unique identifier of the **OH_Rdb_Store** struct.| 236| [Rdb_DistributedConfig::version](#version-13) | Version of the **Rdb_DistributedConfig** struct.| 237| [Rdb_DistributedConfig::isAutoSync](#isautosync) | Whether the table supports automatic sync.| 238| [Rdb_KeyInfo::count](#count) | Number of the changed primary keys or row numbers.| 239| [Rdb_KeyInfo::type](#type) | Type ([OH_ColumnType](#oh_columntype)) of the primary key.| 240| [Rdb_KeyInfo::Rdb_KeyData::integer](#integer) | Data of the uint64_t type.| 241| [Rdb_KeyInfo::Rdb_KeyData::real](#real) | Data of the double type.| 242| [Rdb_KeyInfo::Rdb_KeyData::text](#text) | Data of the char \* type.| 243| [Rdb_KeyInfo::data](_rdb___key_info.md#member-variables)| Changed data.| 244| [Rdb_ChangeInfo::version](#version-23) | Version of the **Rdb_DistributedConfig** struct.| 245| [Rdb_ChangeInfo::tableName](#tablename) | Name of the table with data changes.| 246| [Rdb_ChangeInfo::ChangeType](#changetype) | Type of the data changed, which can be data or asset.| 247| [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.| 248| [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.| 249| [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.| 250| [Rdb_SubscribeCallback::detailsObserver](#detailsobserver) | Callback used to return the details about the device-cloud data change.| 251| [Rdb_SubscribeCallback::briefObserver](#briefobserver) | Callback used to return the device-cloud data change event.| 252| [Rdb_DataObserver::context](#context-12) | Context of the data observer.| 253| [Rdb_DataObserver::callback](#callback-12) | Callback used to return the result.| 254| [Rdb_Statistic::total](#total) | Total number of rows to be synced between the device and cloud in the database table.| 255| [Rdb_Statistic::successful](#successful) | Number of rows that are successfully synced between the device and cloud in the database table.| 256| [Rdb_Statistic::failed](#failed) | Number of rows that failed to be synced between the device and cloud in the database table.| 257| [Rdb_Statistic::remained](#remained) | Number of rows that are not executed for device-cloud sync in the database table.| 258| [Rdb_TableDetails::table](#table) | Database table name.| 259| [Rdb_TableDetails::upload](#upload) | Statistics of the device-cloud upload tasks.| 260| [Rdb_TableDetails::download](#download) | Statistics of the device-cloud download tasks.| 261| [Rdb_ProgressDetails::version](#version-33) | Version of the **OH_TableDetails** struct.| 262| [Rdb_ProgressDetails::schedule](#schedule) | Device-cloud sync process.| 263| [Rdb_ProgressDetails::code](#code) | Device-cloud sync state.| 264| [Rdb_ProgressDetails::tableLength](#tablelength) | Number of the tables synced between the device and cloud.| 265| [Rdb_ProgressObserver::context](#context-22) | Context of the device-cloud sync progress observer.| 266| [Rdb_ProgressObserver::callback](#callback-22) | Callback used to return the device-cloud sync progress.| 267 268 269## Macro Description 270 271 272### DISTRIBUTED_CHANGE_INFO_VERSION 273 274``` 275#define DISTRIBUTED_CHANGE_INFO_VERSION 1 276``` 277 278**Description** 279 280Version of [Rdb_ChangeInfo](_rdb___change_info.md). 281 282**Since**: 11 283 284 285### DISTRIBUTED_CONFIG_VERSION 286 287``` 288#define DISTRIBUTED_CONFIG_VERSION 1 289``` 290 291**Description** 292 293Version of [Rdb_DistributedConfig](_rdb___distributed_config.md). 294 295**Since**: 11 296 297 298### DISTRIBUTED_PROGRESS_DETAIL_VERSION 299 300``` 301#define DISTRIBUTED_PROGRESS_DETAIL_VERSION 1 302``` 303 304**Description** 305 306Version of **OH_ProgressDetails**. 307 308**Since**: 11 309 310 311## Type Description 312 313 314### OH_Rdb_ConfigV2 315 316``` 317typedef struct OH_Rdb_ConfigV2 OH_Rdb_ConfigV2 318``` 319 320**Description** 321 322Defines a struct for the RDB store configuration. Different from [OH_Rdb_Config](_o_h___rdb___config.md), this struct does not expose its member variables externally. Methods are used to configure the properties of this struct. 323 324**Since**: 14 325 326 327### Rdb_DBType 328 329``` 330typedef enum Rdb_DBType Rdb_DBType 331``` 332 333**Description** 334 335Defines an enum for database kernel types. 336 337**Since**: 14 338 339### OH_ColumnType 340 341``` 342typedef enum OH_ColumnType OH_ColumnType 343``` 344 345**Description** 346 347Defines an enum for the types of the fields in an RDB store. 348 349**Since**: 10 350 351 352### OH_Cursor 353 354``` 355typedef struct OH_Cursor OH_Cursor 356``` 357 358**Description** 359 360Defines a struct for a result set. 361 362APIs are provided to access the result set obtained by querying the RDB store. 363 364**Since**: 10 365 366 367### OH_OrderType 368 369``` 370typedef enum OH_OrderType OH_OrderType 371``` 372 373**Description** 374 375Defines an enum for sorting types. 376 377**Since**: 10 378 379 380### OH_Predicates 381 382``` 383typedef struct OH_Predicates OH_Predicates 384``` 385 386**Description** 387 388Defines a **predicates** object. 389 390**Since**: 10 391 392 393### OH_Rdb_ErrCode 394 395``` 396typedef enum OH_Rdb_ErrCode OH_Rdb_ErrCode 397``` 398 399**Description** 400 401Defines an enum for error codes. 402 403**Since**: 10 404 405 406### OH_Rdb_SecurityLevel 407 408``` 409typedef enum OH_Rdb_SecurityLevel OH_Rdb_SecurityLevel 410``` 411 412**Description** 413 414Defines an enum for RDB store security levels. 415 416**Since**: 10 417 418 419### OH_VBucket 420 421``` 422typedef struct OH_VBucket OH_VBucket 423``` 424 425**Description** 426 427Defines a struct for the types of the key and value in a KV pair. 428 429**Since**: 10 430 431 432### OH_VObject 433 434``` 435typedef struct OH_VObject OH_VObject 436``` 437 438**Description** 439 440Defines a struct for allowed data types. 441 442**Since**: 10 443 444 445### Rdb_BriefObserver 446 447``` 448typedef void(* Rdb_BriefObserver) (void *context, const char *values[], uint32_t count) 449``` 450 451**Description** 452 453Defines a callback used to return the device-cloud data change event. 454 455**Since**: 11 456 457**Parameters** 458 459| Name| Description| 460| -------- | -------- | 461| context | Pointer to the context of the data observer.| 462| values | Pointer to the accounts whose device-cloud data is changed.| 463| count | Number of accounts whose device-cloud data is changed.| 464 465 466### Rdb_ChangeInfo 467 468``` 469typedef struct Rdb_ChangeInfo Rdb_ChangeInfo 470``` 471 472**Description** 473 474Defines a struct for the details about the device-cloud sync process. 475 476**Since**: 11 477 478 479### Rdb_ChangeType 480 481``` 482typedef enum Rdb_ChangeType Rdb_ChangeType 483``` 484 485**Description** 486 487Defines an enum for data change types. 488 489**Since**: 11 490 491 492### Rdb_DataObserver 493 494``` 495typedef struct Rdb_DataObserver Rdb_DataObserver 496``` 497 498**Description** 499 500Defines a struct for the data observer. 501 502**Since**: 11 503 504 505### Rdb_DetailsObserver 506 507``` 508typedef void(* Rdb_DetailsObserver) (void *context, const Rdb_ChangeInfo **changeInfo, uint32_t count) 509``` 510 511**Description** 512 513Defines a callback used to return the details about the device-cloud data change. 514 515**Since**: 11 516 517**Parameters** 518 519| Name| Description| 520| -------- | -------- | 521| context | Pointer to the context of the data observer.| 522| changeInfo | Pointer to [Rdb_ChangeInfo](_rdb___change_info.md).| 523| count | Number of changed tables.| 524 525**See** 526 527[Rdb_ChangeInfo](_rdb___change_info.md). 528 529 530### Rdb_DistributedConfig 531 532``` 533typedef struct Rdb_DistributedConfig Rdb_DistributedConfig 534``` 535 536**Description** 537 538Defines a struct for distributed configuration of a table. 539 540**Since**: 11 541 542 543### Rdb_DistributedType 544 545``` 546typedef enum Rdb_DistributedType Rdb_DistributedType 547``` 548 549**Description** 550 551Defines an enum for distributed types. 552 553**Since**: 11 554 555 556### Rdb_KeyInfo 557 558``` 559typedef struct Rdb_KeyInfo Rdb_KeyInfo 560``` 561 562**Description** 563 564Defines a struct for the primary key or row number of the row that changes. 565 566**Since**: 11 567 568 569### Rdb_Progress 570 571``` 572typedef enum Rdb_Progress Rdb_Progress 573``` 574 575**Description** 576 577Defines an enum for device-cloud sync progresses. 578 579**Since**: 11 580 581 582### Rdb_ProgressCallback 583 584``` 585typedef void(* Rdb_ProgressCallback) (void *context, Rdb_ProgressDetails *progressDetails) 586``` 587 588**Description** 589 590Defines a callback used to return the device-cloud sync progress. 591 592**Since**: 11 593 594**Parameters** 595 596| Name| Description| 597| -------- | -------- | 598| progressDetails | Details about the device-cloud sync progress.| 599 600**See** 601 602[Rdb_ProgressDetails](_rdb___progress_details.md). 603 604 605### Rdb_ProgressCode 606 607``` 608typedef enum Rdb_ProgressCode Rdb_ProgressCode 609``` 610 611**Description** 612 613Defines an enum for device-cloud sync states. 614 615**Since**: 11 616 617 618### Rdb_ProgressDetails 619 620``` 621typedef struct Rdb_ProgressDetails Rdb_ProgressDetails 622``` 623 624**Description** 625 626Defines a struct for statistics of the overall device-cloud sync (upload and download) tasks of an RDB store. 627 628**Since**: 11 629 630 631### Rdb_ProgressObserver 632 633``` 634typedef struct Rdb_ProgressObserver Rdb_ProgressObserver 635``` 636 637**Description** 638 639Defines a struct for the observer for the device-cloud sync progress. 640 641**Since**: 11 642 643 644### Rdb_SecurityArea 645 646``` 647typedef enum Rdb_SecurityArea Rdb_SecurityArea 648``` 649 650**Description** 651 652Defines an enum for security area levels of an RDB store. 653 654**Since**: 11 655 656 657### Rdb_Statistic 658 659``` 660typedef struct Rdb_Statistic Rdb_Statistic 661``` 662 663**Description** 664 665Defines a struct for the device-cloud sync statistics of a database table. 666 667**Since**: 11 668 669 670### Rdb_SubscribeCallback 671 672``` 673typedef union Rdb_SubscribeCallback Rdb_SubscribeCallback 674``` 675 676**Description** 677 678Defines a callback used to return the subscribed event. 679 680**Since**: 11 681 682 683### Rdb_SubscribeType 684 685``` 686typedef enum Rdb_SubscribeType Rdb_SubscribeType 687``` 688 689**Description** 690 691Defines an enum for subscription types. 692 693**Since**: 11 694 695 696### Rdb_SyncCallback 697 698``` 699typedef void(* Rdb_SyncCallback) (Rdb_ProgressDetails *progressDetails) 700``` 701 702**Description** 703 704Defines a callback for device-cloud sync. 705 706**Since**: 11 707 708**Parameters** 709 710| Name| Description| 711| -------- | -------- | 712| progressDetails | Statistics of device-cloud sync.| 713 714**See** 715 716[OH_Rdb_Store](_o_h___rdb___store.md). 717 718 719### Rdb_SyncMode 720 721``` 722typedef enum Rdb_SyncMode Rdb_SyncMode 723``` 724 725**Description** 726 727Defines an enum for RDB sync modes. 728 729**Since**: 11 730 731 732### Rdb_TableDetails 733 734``` 735typedef struct Rdb_TableDetails Rdb_TableDetails 736``` 737 738**Description** 739 740Defines a struct for statistics of device-cloud upload and download tasks of a database table. 741 742**Since**: 11 743 744## Enum Description 745 746 747### Rdb_DBType 748 749``` 750enum Rdb_DBType 751``` 752 753**Description** 754 755Enumerates the database kernel types. 756 757**Since**: 14 758 759| Value| Description| 760| -------- | -------- | 761| RDB_SQLITE | SQLite is used as the database kernel.| 762| RDB_CAYLEY | Cayley is used as the database kernel.| 763| DBTYPE_BUTT | Maximum value of the database kernel type, which is an invalid value.| 764 765### OH_ColumnType 766 767``` 768enum OH_ColumnType 769``` 770 771**Description** 772 773Enumerates the field types in an RDB store. 774 775**Since**: 10 776 777| Value| Description| 778| -------- | -------- | 779| TYPE_NULL | Null.| 780| TYPE_INT64 | INT64.| 781| TYPE_REAL | REAL.| 782| TYPE_TEXT | TEXT.| 783| TYPE_BLOB | BLOB.| 784| TYPE_ASSET<sup>11+</sup> | ASSET (asset attachment).<br>This value is supported since API version 11.| 785| TYPE_ASSETS<sup>11+</sup> | ASSETS (multiple asset attachments).<br>This value is supported since API version 11.| 786 787 788### OH_OrderType 789 790``` 791enum OH_OrderType 792``` 793 794**Description** 795 796Enumerates the sorting types. 797 798**Since**: 10 799 800| Value| Description| 801| -------- | -------- | 802| ASC | Ascending order.| 803| DESC | Descending order.| 804 805 806### OH_Rdb_ErrCode 807 808``` 809enum OH_Rdb_ErrCode 810``` 811 812**Description** 813 814Enumerates the error codes. 815 816**Since**: 10 817 818| Value| Description| 819| -------- | -------- | 820| RDB_ERR | Execution failed.| 821| RDB_OK | Execution successful.| 822| E_BASE | Base of the error code.| 823| RDB_E_NOT_SUPPORTED | The RDB store does not have this capability.| 824| RDB_E_ERROR | Common exception.| 825| RDB_E_INVALID_ARGS | Invalid parameter.| 826| RDB_E_CANNOT_UPDATE_READONLY | Failed to update data because the RDB store is read-only.| 827| RDB_E_REMOVE_FILE | Failed to delete the file.| 828| RDB_E_EMPTY_TABLE_NAME | The table name is empty.| 829| RDB_E_EMPTY_VALUES_BUCKET | The content of the KV pair is empty.| 830| RDB_E_EXECUTE_IN_STEP_QUERY | The SQL statement executed during the query is incorrect.| 831| RDB_E_INVALID_COLUMN_INDEX | The column index is invalid.| 832| RDB_E_INVALID_COLUMN_TYPE | The column type is invalid.| 833| RDB_E_EMPTY_FILE_NAME | The file name is empty.| 834| RDB_E_INVALID_FILE_PATH | The file path is invalid.| 835| RDB_E_TRANSACTION_IN_EXECUTE | Failed to start the transaction.| 836| RDB_E_INVALID_STATEMENT | Failed to precompile the SQL statements.| 837| RDB_E_EXECUTE_WRITE_IN_READ_CONNECTION | Failed to perform a write operation in a read connection.| 838| RDB_E_BEGIN_TRANSACTION_IN_READ_CONNECTION | Failed to start the transaction in a read connection.| 839| RDB_E_NO_TRANSACTION_IN_SESSION | The transaction to start does not exist in the database session.| 840| RDB_E_MORE_STEP_QUERY_IN_ONE_SESSION | Multiple queries are executed in a database session.| 841| RDB_E_NO_ROW_IN_QUERY | The result set does not contain any record.| 842| RDB_E_INVALID_BIND_ARGS_COUNT | The number of parameters bound in the SQL statement is invalid.| 843| RDB_E_INVALID_OBJECT_TYPE | The object type is invalid.| 844| RDB_E_INVALID_CONFLICT_FLAG | The conflict resolution type is invalid.| 845| RDB_E_HAVING_CLAUSE_NOT_IN_GROUP_BY | The HAVING keyword can be used only after GROUP BY.| 846| RDB_E_NOT_SUPPORTED_BY_STEP_RESULT_SET | The result set by step is not supported.| 847| RDB_E_STEP_RESULT_SET_CROSS_THREADS | Failed to obtain the result set.| 848| RDB_E_STEP_RESULT_QUERY_NOT_EXECUTED | The result set query statement is not executed.| 849| RDB_E_STEP_RESULT_IS_AFTER_LAST | The cursor of the result set is already in the last row.| 850| RDB_E_STEP_RESULT_QUERY_EXCEEDED | The number of result set query times exceeds the limit.| 851| RDB_E_STATEMENT_NOT_PREPARED | The SQL statement is not precompiled.| 852| RDB_E_EXECUTE_RESULT_INCORRECT | The database execution result is incorrect.| 853| RDB_E_STEP_RESULT_CLOSED | The result set has been closed.| 854| RDB_E_RELATIVE_PATH | The file path is a relative path.| 855| RDB_E_EMPTY_NEW_ENCRYPT_KEY | The new encrypt key is empty.| 856| RDB_E_CHANGE_UNENCRYPTED_TO_ENCRYPTED | The RDB store is non-encrypted and cannot be changed.| 857| RDB_E_CHANGE_ENCRYPT_KEY_IN_BUSY | The database does not respond when the database key is updated.| 858| RDB_E_STEP_STATEMENT_NOT_INIT | The precompiled SQL statement is not initialized.| 859| RDB_E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE | The WAL mode does not support the ATTACH operation.| 860| RDB_E_CREATE_FOLDER_FAIL | Failed to create the folder.| 861| RDB_E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL | Failed to build the SQL statement.| 862| RDB_E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY | The database session does not provide a connection.| 863| RDB_E_STORE_SESSION_NO_CURRENT_TRANSACTION | The transaction does not exist in the database session.| 864| RDB_E_NOT_SUPPORT | The current operation is not supported.| 865| RDB_E_INVALID_PARCEL | The current PARCEL is invalid.| 866| RDB_E_QUERY_IN_EXECUTE | Failed to execute query.| 867| RDB_E_SET_PERSIST_WAL | Failed to set the persistence of the database file in WAL mode.| 868| RDB_E_DB_NOT_EXIST | The database does not exist.| 869| RDB_E_ARGS_READ_CON_OVERLOAD | The number of read connections to set is greater than the limit.| 870| RDB_E_WAL_SIZE_OVER_LIMIT | The WAL log file size exceeds the default value.| 871| RDB_E_CON_OVER_LIMIT | The number of database connections has reached the limit.| 872 873 874### OH_Rdb_SecurityLevel 875 876``` 877enum OH_Rdb_SecurityLevel 878``` 879 880**Description** 881 882Enumerates the RDB store security levels. 883 884**Since**: 10 885 886| Value| Description| 887| -------- | -------- | 888| S1 | The security level of the RDB store is low.<br>If data leakage occurs, minor impact will be caused.| 889| S2 | The security level of the RDB store is medium.<br>If data leakage occurs, moderate impact will be caused.| 890| S3 | The security level of the RDB store is high.<br>If data leakage occurs, major impact will be caused.| 891| S4 | The security level of the RDB store is critical.<br>If data leakage occurs, critical impact will be caused.| 892 893 894### Rdb_ChangeType 895 896``` 897enum Rdb_ChangeType 898``` 899 900**Description** 901 902Enumerates the data change types. 903 904**Since**: 11 905 906| Value| Description| 907| -------- | -------- | 908| RDB_DATA_CHANGE | Data change.| 909| RDB_ASSET_CHANGE | Asset change.| 910 911 912### Rdb_DistributedType 913 914``` 915enum Rdb_DistributedType 916``` 917 918**Description** 919 920Enumerates the distributed types. 921 922**Since**: 11 923 924| Value| Description| 925| -------- | -------- | 926| RDB_DISTRIBUTED_CLOUD | Distributed database tables for device-cloud sync.| 927 928 929### Rdb_Progress 930 931``` 932enum Rdb_Progress 933``` 934 935**Description** 936 937Enumerates the device-cloud sync progresses. 938 939**Since**: 11 940 941| Value| Description| 942| -------- | -------- | 943| RDB_SYNC_BEGIN | The device-cloud sync starts.| 944| RDB_SYNC_IN_PROGRESS | The device-cloud sync is in progress.| 945| RDB_SYNC_FINISH | The device-cloud sync is finished.| 946 947 948### Rdb_ProgressCode 949 950``` 951enum Rdb_ProgressCode 952``` 953 954**Description** 955 956Enumerates the device-cloud sync states. 957 958**Since**: 11 959 960| Value| Description| 961| -------- | -------- | 962| RDB_SUCCESS | The device-cloud sync is successful.| 963| RDB_UNKNOWN_ERROR | An unknown error occurs during the device-cloud sync.| 964| RDB_NETWORK_ERROR | A network error occurs during the device-cloud sync.| 965| RDB_CLOUD_DISABLED | The cloud is unavailable.| 966| RDB_LOCKED_BY_OTHERS | The device-cloud sync of another device is being performed.| 967| RDB_RECORD_LIMIT_EXCEEDED | The number of records or size of the data to be synced exceeds the maximum. The maximum value is configured on the cloud.| 968| RDB_NO_SPACE_FOR_ASSET | The remaining cloud space is less than the size of the data to be synced.| 969 970 971### Rdb_SecurityArea 972 973``` 974enum Rdb_SecurityArea 975``` 976 977**Description** 978 979Enumerates the security area levels of an RDB store. 980 981**Since**: 11 982 983| Value| Description| 984| -------- | -------- | 985| RDB_SECURITY_AREA_EL1 | Security area level 1.| 986| RDB_SECURITY_AREA_EL2 | Security area level 2.| 987| RDB_SECURITY_AREA_EL3 | Security area level 3.| 988| RDB_SECURITY_AREA_EL4 | Security area level 4.| 989 990 991### Rdb_SubscribeType 992 993``` 994enum Rdb_SubscribeType 995``` 996 997**Description** 998 999Enumerates the subscription types. 1000 1001**Since**: 11 1002 1003| Value| Description| 1004| -------- | -------- | 1005| RDB_SUBSCRIBE_TYPE_CLOUD | Subscription of cloud data changes.| 1006| RDB_SUBSCRIBE_TYPE_CLOUD_DETAILS | Subscription of cloud data change details.| 1007| RDB_SUBSCRIBE_TYPE_LOCAL_DETAILS<sup>12+</sup> | Subscribe to details of the local data change. This value is available since API version 12.| 1008 1009 1010### Rdb_SyncMode 1011 1012``` 1013enum Rdb_SyncMode 1014``` 1015 1016**Description** 1017 1018Enumerates the RDB sync modes. 1019 1020**Since**: 11 1021 1022| Value| Description| 1023| -------- | -------- | 1024| RDB_SYNC_MODE_TIME_FIRST | Synchronize with the data with the latest modification time.| 1025| RDB_SYNC_MODE_NATIVE_FIRST | Synchronize data from a local device to the cloud.| 1026| RDB_SYNC_MODE_CLOUD_FIRST | Synchronize data from the cloud to a local device.| 1027 1028 1029## Function Description 1030 1031 1032### OH_Rdb_CreateOrOpen() 1033 1034``` 1035OH_Rdb_Store *OH_Rdb_CreateOrOpen (const OH_Rdb_ConfigV2 *config, int *errCode ) 1036``` 1037 1038**Description** 1039 1040Creates or opens an [OH_Rdb_Store](_o_h___rdb___store.md) instance based on the given [OH_Rdb_ConfigV2](#oh_rdb_configv2). 1041 1042**Since**: 14 1043 1044**Parameters** 1045 1046| Name| Description| 1047| -------- | -------- | 1048| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1049| errCode | Pointer to the execution result of this API. **RDB_OK** indicates the operation is successful. **RDB_E_INVALID_ARGS** indicates invalid parameters are specified.| 1050 1051**Returns** 1052 1053Returns the pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance created if the operation is successful; returns null otherwise. 1054 1055**See** 1056 1057[OH_Rdb_ConfigV2](#oh_rdb_configv2), [OH_Rdb_Store](_o_h___rdb___store.md). 1058 1059 1060### OH_Rdb_BeginTransWithTrxId() 1061 1062``` 1063int OH_Rdb_BeginTransWithTrxId (OH_Rdb_Store *store, int64_t *trxId ) 1064``` 1065 1066**Description** 1067 1068Starts a transaction and obtains the transaction ID before executing an SQL statement. 1069 1070**Since**: 14 1071 1072**Parameters** 1073 1074| Name| Description| 1075| -------- | -------- | 1076| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1077| trxId | Pointer to the transaction ID obtained.| 1078 1079**Returns** 1080 1081Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. <br>**RDB_E_NOT_SUPPORTED** indicates that the current operation is not supported. 1082 1083**See** 1084 1085[OH_Rdb_Store](_o_h___rdb___store.md). 1086 1087 1088### OH_Rdb_CommitByTrxId() 1089 1090``` 1091int OH_Rdb_CommitByTrxId (OH_Rdb_Store *store, int64_t trxId ) 1092``` 1093 1094**Description** 1095 1096Commits the executed SQL statement based on the specified transaction ID. 1097 1098**Since**: 14 1099 1100**Parameters** 1101 1102| Name| Description| 1103| -------- | -------- | 1104| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1105| trxId | Transaction ID.| 1106 1107**Returns** 1108 1109Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. **RDB_E_INVALID_ARGS** indicates invalid parameters are specified.<br>Possible causes: A null pointer is passed in; the transaction ID is not obtained by [OH_Rdb_BeginTransWithTrxId](#oh_rdb_begintranswithtrxid); the transaction ID has been used by [OH_Rdb_CommitByTrxId](#oh_rdb_commitbytrxid); the transaction ID has been used by [OH_Rdb_RollBackByTrxId](#oh_rdb_rollbackbytrxid). <br>**RDB_E_NOT_SUPPORTED** indicates that the current operation is not supported. 1110 1111**See** 1112 1113[OH_Rdb_Store](_o_h___rdb___store.md). 1114 1115 1116### OH_Rdb_CreateConfig() 1117 1118``` 1119OH_Rdb_ConfigV2 *OH_Rdb_CreateConfig () 1120``` 1121 1122**Description** 1123 1124Creates an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1125 1126**Since**: 14 1127 1128**Returns** 1129 1130Returns a pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance created. 1131 1132**See** 1133 1134[OH_Rdb_ConfigV2](#oh_rdb_configv2) 1135 1136 1137 1138### OH_Rdb_DeleteStoreV2() 1139 1140``` 1141int OH_Rdb_DeleteStoreV2 (const OH_Rdb_ConfigV2 *config) 1142``` 1143 1144**Description** 1145 1146Deletes an RDB store based on the given [OH_Rdb_ConfigV2](#oh_rdb_configv2). 1147 1148**Since**: 14 1149 1150**Parameters** 1151 1152| Name| Description| 1153| -------- | -------- | 1154| config | Pointer to the database configuration.| 1155 1156**Returns** 1157 1158Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1159 1160**See** 1161 1162OH_Rdb_ErrCode. 1163 1164 1165### OH_Rdb_DestroyConfig() 1166 1167``` 1168int OH_Rdb_DestroyConfig (OH_Rdb_ConfigV2 *config) 1169``` 1170 1171**Description** 1172 1173Destroys an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1174 1175**Since**: 14 1176 1177**Parameters** 1178 1179| Name| Description| 1180| -------- | -------- | 1181| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1182 1183**Returns** 1184 1185Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1186 1187 1188### OH_Rdb_ExecuteByTrxId() 1189 1190``` 1191int OH_Rdb_ExecuteByTrxId (OH_Rdb_Store *store, int64_t trxId, const char *sql ) 1192``` 1193 1194**Description** 1195 1196Executes an SQL statement that returns no value based on the specified transaction ID. 1197 1198**Since**: 14 1199 1200**Parameters** 1201 1202| Name| Description| 1203| -------- | -------- | 1204| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1205| trxId | Transaction ID returned by [OH_Rdb_BeginTransWithTrxId](#oh_rdb_begintranswithtrxid). The value **0** indicates that no transaction is enabled.| 1206| sql | Pointer to the SQL statement to execute.| 1207 1208**Returns** 1209 1210Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. Possible causes: A null pointer is passed in; the transaction ID is not obtained by [OH_Rdb_BeginTransWithTrxId](#oh_rdb_begintranswithtrxid); the transaction ID has been used by [OH_Rdb_CommitByTrxId](#oh_rdb_commitbytrxid); the transaction ID has been used by [OH_Rdb_RollBackByTrxId](#oh_rdb_rollbackbytrxid); **store** or **sql** is **NULL**. <br>**RDB_E_NOT_SUPPORTED** indicates that the current operation is not supported. 1211 1212**See** 1213 1214[OH_Rdb_Store](_o_h___rdb___store.md). 1215 1216 1217### OH_Rdb_GetSupportedDbType() 1218 1219``` 1220const int *OH_Rdb_GetSupportedDbType (int *typeCount) 1221``` 1222 1223**Description** 1224 1225Obtains the supported database types. 1226 1227**Since**: 14 1228 1229**Parameters** 1230 1231| Name| Description| 1232| -------- | -------- | 1233| typeCount | Pointer to the length of the array of the supported database types obtained.| 1234 1235**Returns** 1236 1237Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1238 1239 1240### OH_Rdb_RollBackByTrxId() 1241 1242``` 1243int OH_Rdb_RollBackByTrxId (OH_Rdb_Store *store, int64_t trxId ) 1244``` 1245 1246**Description** 1247 1248Rolls back the executed SQL statement based on the specified transaction ID. 1249 1250**Since**: 14 1251 1252**Parameters** 1253 1254| Name| Description| 1255| -------- | -------- | 1256| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1257| trxId | ID of the transaction to be rolled back.| 1258 1259**Returns** 1260 1261Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. Possible causes: A null pointer is passed in; the transaction ID is not obtained by [OH_Rdb_BeginTransWithTrxId](#oh_rdb_begintranswithtrxid); the transaction ID has been used by [OH_Rdb_CommitByTrxId](#oh_rdb_commitbytrxid); the transaction ID has been used by [OH_Rdb_RollBackByTrxId](#oh_rdb_rollbackbytrxid). <br>**RDB_E_NOT_SUPPORTED** indicates that the current operation is not supported. 1262 1263**See** 1264 1265[OH_Rdb_Store](_o_h___rdb___store.md). 1266 1267 1268### OH_Rdb_SetArea() 1269 1270``` 1271int OH_Rdb_SetArea (OH_Rdb_ConfigV2 *config, int area ) 1272``` 1273 1274**Description** 1275 1276Sets the security area level ([Rdb_SecurityArea](#rdb_securityarea)) for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1277 1278**Since**: 14 1279 1280**Parameters** 1281 1282| Name| Description| 1283| -------- | -------- | 1284| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1285| area | Security area level to set. For details, see [Rdb_SecurityArea](#rdb_securityarea).| 1286 1287**Returns** 1288 1289Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1290 1291 1292### OH_Rdb_SetBundleName() 1293 1294``` 1295int OH_Rdb_SetBundleName (OH_Rdb_ConfigV2 *config, const char *bundleName ) 1296``` 1297 1298**Description** 1299 1300Sets the application bundle name for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1301 1302**Since**: 14 1303 1304**Parameters** 1305 1306| Name| Description| 1307| -------- | -------- | 1308| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1309| bundleName | Pointer to the application bundle name to set.| 1310 1311**Returns** 1312 1313Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1314 1315 1316### OH_Rdb_SetDatabaseDir() 1317 1318``` 1319int OH_Rdb_SetDatabaseDir (OH_Rdb_ConfigV2 *config, const char *databaseDir ) 1320``` 1321 1322**Description** 1323 1324Sets the database file path for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1325 1326**Since**: 14 1327 1328**Parameters** 1329 1330| Name| Description| 1331| -------- | -------- | 1332| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1333| dataBaseDir | Pointer to the database file path to set. The full path, including the RDB store name, cannot exceed a maximum of 1024 characters.| 1334 1335**Returns** 1336 1337Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1338 1339 1340### OH_Rdb_SetDbType() 1341 1342``` 1343int OH_Rdb_SetDbType (OH_Rdb_ConfigV2 *config, int dbType ) 1344``` 1345 1346**Description** 1347 1348Sets the database type ([Rdb_DBType](#rdb_dbtype)) for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1349 1350**Since**: 14 1351 1352**Parameters** 1353 1354| Name| Description| 1355| -------- | -------- | 1356| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1357| dbType | Database type to set. For details, see [Rdb_DBType](#rdb_dbtype).| 1358 1359**Returns** 1360 1361Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. <br>**RDB_E_NOT_SUPPORTED** indicates that the current operation is not supported. 1362 1363 1364### OH_Rdb_SetEncrypted() 1365 1366``` 1367int OH_Rdb_SetEncrypted (OH_Rdb_ConfigV2 *config, bool isEncrypted ) 1368``` 1369 1370**Description** 1371 1372Sets whether to encrypt the RDB store for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1373 1374**Since**: 14 1375 1376**Parameters** 1377 1378| Name| Description| 1379| -------- | -------- | 1380| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1381| isEncrypted | Whether to encrypt the RDB store. The value **true** means to encrypt the database, the value **false** means the opposite.| 1382 1383**Returns** 1384 1385Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1386 1387 1388### OH_Rdb_SetModuleName() 1389 1390``` 1391int OH_Rdb_SetModuleName (OH_Rdb_ConfigV2 *config, const char *moduleName ) 1392``` 1393 1394**Description** 1395 1396Sets the module name for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1397 1398**Since**: 14 1399 1400**Parameters** 1401 1402| Name| Description| 1403| -------- | -------- | 1404| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1405| moduleName | Pointer to the module name to set.| 1406 1407**Returns** 1408 1409Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1410 1411 1412### OH_Rdb_SetSecurityLevel() 1413 1414``` 1415int OH_Rdb_SetSecurityLevel (OH_Rdb_ConfigV2 *config, int securityLevel ) 1416``` 1417 1418**Description** 1419 1420Sets the RDB store security level ([OH_Rdb_SecurityLevel](#oh_rdb_securitylevel)) for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1421 1422**Since**: 14 1423 1424**Parameters** 1425 1426| Name| Description| 1427| -------- | -------- | 1428| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1429| securityLevel | RDB store security level to set. For details, see [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel).| 1430 1431**Returns** 1432 1433Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1434 1435 1436### OH_Rdb_SetStoreName() 1437 1438``` 1439int OH_Rdb_SetStoreName (OH_Rdb_ConfigV2 *config, const char *storeName ) 1440``` 1441 1442**Description** 1443 1444Sets the RDB store name for an [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance. 1445 1446**Since**: 14 1447 1448**Parameters** 1449 1450| Name| Description| 1451| -------- | -------- | 1452| config | Pointer to the [OH_Rdb_ConfigV2](#oh_rdb_configv2) instance, which is the configuration of the RDB store.| 1453| storeName | Pointer to the RDB store name to set.| 1454 1455**Returns** 1456 1457Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1458 1459### OH_Rdb_Backup() 1460 1461``` 1462int OH_Rdb_Backup (OH_Rdb_Store *store, const char *databasePath ) 1463``` 1464 1465**Description** 1466 1467Backs up an RDB store in the specified directory. 1468 1469**Since**: 10 1470 1471**Parameters** 1472 1473| Name| Description| 1474| -------- | -------- | 1475| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1476| databasePath | Pointer to the destination directory in which the RDB store is backed up.| 1477 1478**Returns** 1479 1480Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1481 1482**See** 1483 1484[OH_Rdb_Store](_o_h___rdb___store.md). 1485 1486 1487### OH_Rdb_BeginTransaction() 1488 1489``` 1490int OH_Rdb_BeginTransaction (OH_Rdb_Store *store) 1491``` 1492 1493**Description** 1494 1495Starts the transaction before executing the SQL statement. 1496 1497**Since**: 10 1498 1499**Parameters** 1500 1501| Name| Description| 1502| -------- | -------- | 1503| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1504 1505**Returns** 1506 1507Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1508 1509**See** 1510 1511[OH_Rdb_Store](_o_h___rdb___store.md). 1512 1513 1514### OH_Rdb_CloseStore() 1515 1516``` 1517int OH_Rdb_CloseStore (OH_Rdb_Store *store) 1518``` 1519 1520**Description** 1521 1522Closes an [OH_Rdb_Store](_o_h___rdb___store.md) object to reclaim the memory occupied. 1523 1524**Since**: 10 1525 1526**Parameters** 1527 1528| Name| Description| 1529| -------- | -------- | 1530| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1531 1532**Returns** 1533 1534Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1535 1536**See** 1537 1538[OH_Rdb_Store](_o_h___rdb___store.md). 1539 1540 1541### OH_Rdb_CloudSync() 1542 1543``` 1544int OH_Rdb_CloudSync (OH_Rdb_Store *store, Rdb_SyncMode mode, const char *tables, int count, const Rdb_ProgressObserver *observer ) 1545``` 1546 1547**Description** 1548 1549Performs device-cloud sync. 1550 1551**Since**: 11 1552 1553**Parameters** 1554 1555| Name| Description| 1556| -------- | -------- | 1557| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1558| mode | Sync mode [Rdb_SyncMode](#rdb_syncmode).| 1559| tables | Pointer to the names of the tables to be synced.| 1560| count | Number of tables to sync. If the value is **0**, all tables in the RDB store are synced.| 1561| observer | Observer [Rdb_ProgressObserver](_rdb___progress_observer.md) of the device-cloud sync progress.| 1562 1563**Returns** 1564 1565Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1566 1567**See** 1568 1569[OH_Rdb_Store](_o_h___rdb___store.md). 1570 1571 1572### OH_Rdb_Commit() 1573 1574``` 1575int OH_Rdb_Commit (OH_Rdb_Store *store) 1576``` 1577 1578**Description** 1579 1580Commits the executed SQL statement. 1581 1582**Since**: 10 1583 1584**Parameters** 1585 1586| Name| Description| 1587| -------- | -------- | 1588| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1589 1590**Returns** 1591 1592Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1593 1594**See** 1595 1596[OH_Rdb_Store](_o_h___rdb___store.md). 1597 1598 1599### OH_Rdb_CreatePredicates() 1600 1601``` 1602OH_Predicates* OH_Rdb_CreatePredicates (const char *table) 1603``` 1604 1605**Description** 1606 1607Creates an [OH_Predicates](_o_h___predicates.md) instance. 1608 1609**Since**: 10 1610 1611**Parameters** 1612 1613| Name| Description| 1614| -------- | -------- | 1615| table | Pointer to the name of the database table.| 1616 1617**Returns** 1618 1619Returns the pointer to the [OH_Predicates](_o_h___predicates.md) instance created if the operation is successful; returns null otherwise. 1620 1621**See** 1622 1623[OH_Predicates](_o_h___predicates.md). 1624 1625 1626### OH_Rdb_CreateValueObject() 1627 1628``` 1629OH_VObject* OH_Rdb_CreateValueObject () 1630``` 1631 1632**Description** 1633 1634Creates an [OH_VObject](_o_h___v_object.md) instance. 1635 1636**Since**: 10 1637 1638**Returns** 1639 1640Returns the pointer to the [OH_VObject](_o_h___v_object.md) instance created if the operation is successful; returns null otherwise. 1641 1642**See** 1643 1644[OH_VObject](_o_h___v_object.md). 1645 1646 1647### OH_Rdb_CreateValuesBucket() 1648 1649``` 1650OH_VBucket* OH_Rdb_CreateValuesBucket () 1651``` 1652 1653**Description** 1654 1655Creates an [OH_VBucket](_o_h___v_bucket.md) instance. 1656 1657**Since**: 10 1658 1659**Returns** 1660 1661Returns the pointer to the [OH_VBucket](_o_h___v_bucket.md) instance created if the operation is successful; returns null otherwise. 1662 1663**See** 1664 1665[OH_VBucket](_o_h___v_bucket.md). 1666 1667 1668### OH_Rdb_Delete() 1669 1670``` 1671int OH_Rdb_Delete (OH_Rdb_Store *store, OH_Predicates *predicates ) 1672``` 1673 1674**Description** 1675 1676Deletes data from an RDB store based on specified conditions. 1677 1678**Since**: 10 1679 1680**Parameters** 1681 1682| Name| Description| 1683| -------- | -------- | 1684| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1685| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance, which specifies the deletion conditions.| 1686 1687**Returns** 1688 1689Returns the number of affected rows if the operation is successful; returns an error code otherwise. 1690 1691**See** 1692 1693[OH_Rdb_Store](_o_h___rdb___store.md), [OH_Predicates](_o_h___predicates.md). 1694 1695 1696### OH_Rdb_DeleteStore() 1697 1698``` 1699int OH_Rdb_DeleteStore (const OH_Rdb_Config *config) 1700``` 1701 1702**Description** 1703 1704Deletes an RDB store with the specified configuration. 1705 1706**Since**: 10 1707 1708**Parameters** 1709 1710| Name| Description| 1711| -------- | -------- | 1712| config | Pointer to the database configuration.| 1713 1714**Returns** 1715 1716Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 1717 1718 1719### OH_Rdb_Execute() 1720 1721``` 1722int OH_Rdb_Execute (OH_Rdb_Store *store, const char *sql ) 1723``` 1724 1725**Description** 1726 1727Executes an SQL statement but returns no value. 1728 1729**Since**: 10 1730 1731**Parameters** 1732 1733| Name| Description| 1734| -------- | -------- | 1735| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1736| sql | Pointer to the SQL statement to execute.| 1737 1738**Returns** 1739 1740Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 1741 1742**See** 1743 1744[OH_Rdb_Store](_o_h___rdb___store.md). 1745 1746 1747### OH_Rdb_ExecuteQuery() 1748 1749``` 1750OH_Cursor* OH_Rdb_ExecuteQuery (OH_Rdb_Store *store, const char *sql ) 1751``` 1752 1753**Description** 1754 1755Executes the SQL statement to query data in an RDB store. 1756 1757**Since**: 10 1758 1759**Parameters** 1760 1761| Name| Description| 1762| -------- | -------- | 1763| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1764| sql | Pointer to the SQL statement to execute.| 1765 1766**Returns** 1767 1768Returns the pointer to the [OH_Cursor](_o_h___cursor.md) instance if the operation is successful; returns null otherwise. 1769 1770**See** 1771 1772[OH_Rdb_Store](_o_h___rdb___store.md). 1773 1774 1775### OH_Rdb_FindModifyTime() 1776 1777``` 1778OH_Cursor* OH_Rdb_FindModifyTime (OH_Rdb_Store *store, const char *tableName, const char *columnName, OH_VObject *values ) 1779``` 1780 1781**Description** 1782 1783Obtains the last modification time of a table in an RDB store. 1784 1785**Since**: 11 1786 1787**Parameters** 1788 1789| Name| Description| 1790| -------- | -------- | 1791| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1792| tableName | Pointer to the target distributed database table.| 1793| columnName | Pointer to the column of the database table to query.| 1794| 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.| 1795 1796**Returns** 1797 1798Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 1799 1800**See** 1801 1802[OH_Rdb_Store](_o_h___rdb___store.md). 1803 1804 1805### OH_Rdb_GetOrOpen() 1806 1807``` 1808OH_Rdb_Store* OH_Rdb_GetOrOpen (const OH_Rdb_Config *config, int *errCode ) 1809``` 1810 1811**Description** 1812 1813Obtains an [OH_Rdb_Store](_o_h___rdb___store.md) instance for RDB store operations. 1814 1815**Since**: 10 1816 1817**Parameters** 1818 1819| Name| Description| 1820| -------- | -------- | 1821| config | Pointer to the [OH_Rdb_Config](_o_h___rdb___config.md) instance, which specifies the database configuration.| 1822| errCode | Function execution status.| 1823 1824**Returns** 1825 1826Returns the pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance created if the operation is successful; returns null otherwise. 1827 1828**See** 1829 1830[OH_Rdb_Config](_o_h___rdb___config.md), [OH_Rdb_Store](_o_h___rdb___store.md). 1831 1832 1833### OH_Rdb_GetTableDetails() 1834 1835``` 1836Rdb_TableDetails* OH_Rdb_GetTableDetails (Rdb_ProgressDetails *progress, int32_t version ) 1837``` 1838 1839**Description** 1840 1841Obtains the device-cloud sync statistics of a table. 1842 1843**Since**: 11 1844 1845**Parameters** 1846 1847| Name| Description| 1848| -------- | -------- | 1849| progress | Pointer to the **OH_ProgressDetails** instance.| 1850| version | Version of [Rdb_ProgressDetails](_rdb___progress_details.md).| 1851 1852**Returns** 1853 1854Returns a pointer to [Rdb_TableDetails](_rdb___table_details.md) if the operation is successful; returns null otherwise. 1855 1856**See** 1857 1858[Rdb_ProgressDetails](_rdb___progress_details.md) 1859 1860[Rdb_TableDetails](_rdb___table_details.md) 1861 1862 1863### OH_Rdb_GetVersion() 1864 1865``` 1866int OH_Rdb_GetVersion (OH_Rdb_Store *store, int *version ) 1867``` 1868 1869**Description** 1870 1871Obtains the RDB store version. 1872 1873**Since**: 10 1874 1875**Parameters** 1876 1877| Name| Description| 1878| -------- | -------- | 1879| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1880| version | Pointer to the version obtained.| 1881 1882**Returns** 1883 1884Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 1885 1886**See** 1887 1888[OH_Rdb_Store](_o_h___rdb___store.md). 1889 1890 1891### OH_Rdb_Insert() 1892 1893``` 1894int OH_Rdb_Insert (OH_Rdb_Store *store, const char *table, OH_VBucket *valuesBucket ) 1895``` 1896 1897**Description** 1898 1899Inserts a row of data into a table. 1900 1901**Since**: 10 1902 1903**Parameters** 1904 1905| Name| Description| 1906| -------- | -------- | 1907| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1908| table | Pointer to the target table.| 1909| valuesBucket | Pointer to the data [OH_VBucket](_o_h___v_bucket.md) to insert.| 1910 1911**Returns** 1912 1913Returns the row ID if the operation is successful; returns an error code otherwise. 1914 1915**See** 1916 1917[OH_Rdb_Store](_o_h___rdb___store.md), [OH_VBucket](_o_h___v_bucket.md). 1918 1919### OH_Rdb_LockRow() 1920 1921``` 1922int OH_Rdb_LockRow (OH_Rdb_Store *store, OH_Predicates *predicates ) 1923``` 1924 1925**Description** 1926 1927Locks data in an RDB store based on specified conditions. The locked data will be blocked from the device-cloud sync. 1928 1929**Since**: 12 1930 1931**Parameters** 1932 1933| Name| Description| 1934| -------- | -------- | 1935| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1936| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance, which specifies the lock conditions.| 1937 1938**Returns** 1939 1940Result of the lock operation. 1941 1942**See** 1943 1944[OH_Rdb_Store](_o_h___rdb___store.md), [OH_Predicates](_o_h___predicates.md). 1945 1946### OH_Rdb_Query() 1947 1948``` 1949OH_Cursor* OH_Rdb_Query (OH_Rdb_Store *store, OH_Predicates *predicates, const char *const *columnNames, int length ) 1950``` 1951 1952**Description** 1953 1954Queries data in an RDB store based on specified conditions. 1955 1956**Since**: 10 1957 1958**Parameters** 1959 1960| Name| Description| 1961| -------- | -------- | 1962| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1963| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance, which specifies the query conditions.| 1964| columnNames | Pointer to the columns to query. If this parameter is not specified, data of columns will be queried.| 1965| 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.| 1966 1967**Returns** 1968 1969Returns the pointer to the [OH_Cursor](_o_h___cursor.md) instance if the operation is successful; returns null otherwise. 1970 1971**See** 1972 1973[OH_Rdb_Store](_o_h___rdb___store.md), [OH_Predicates](_o_h___predicates.md), [OH_Cursor](_o_h___cursor.md). 1974 1975### OH_Rdb_QueryLockedRow() 1976 1977``` 1978OH_Cursor *OH_Rdb_QueryLockedRow (OH_Rdb_Store *store, OH_Predicates *predicates, const char *const *columnNames, int length ) 1979``` 1980 1981**Description** 1982 1983Queries the locked data in an RDB store. 1984 1985**Since**: 12 1986 1987**Parameters** 1988 1989| Name| Description| 1990| -------- | -------- | 1991| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 1992| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance, which specifies the query conditions.| 1993| columnNames | Pointer to the columns to query. If this parameter is not specified, data of columns will be queried.| 1994| 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.| 1995 1996**Returns** 1997 1998Returns the pointer to the [OH_Cursor](_o_h___cursor.md) instance if the operation is successful; returns null otherwise. 1999 2000**See** 2001 2002[OH_Rdb_Store](_o_h___rdb___store.md), [OH_Predicates](_o_h___predicates.md), [OH_Cursor](_o_h___cursor.md). 2003 2004### OH_Rdb_Restore() 2005 2006``` 2007int OH_Rdb_Restore (OH_Rdb_Store *store, const char *databasePath ) 2008``` 2009 2010**Description** 2011 2012Restores an RDB store from the specified database backup file. 2013 2014**Since**: 10 2015 2016**Parameters** 2017 2018| Name| Description| 2019| -------- | -------- | 2020| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2021| databasePath | Pointer to the destination directory in which the RDB store is backed up.| 2022 2023**Returns** 2024 2025Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 2026 2027**See** 2028 2029[OH_Rdb_Store](_o_h___rdb___store.md). 2030 2031 2032### OH_Rdb_RollBack() 2033 2034``` 2035int OH_Rdb_RollBack (OH_Rdb_Store *store) 2036``` 2037 2038**Description** 2039 2040Rolls back the SQL statement executed. 2041 2042**Since**: 10 2043 2044**Parameters** 2045 2046| Name| Description| 2047| -------- | -------- | 2048| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2049 2050**Returns** 2051 2052Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 2053 2054**See** 2055 2056[OH_Rdb_Store](_o_h___rdb___store.md). 2057 2058 2059### OH_Rdb_SetDistributedTables() 2060 2061``` 2062int OH_Rdb_SetDistributedTables (OH_Rdb_Store *store, const char *tables[], uint32_t count, Rdb_DistributedType type, const Rdb_DistributedConfig * config ) 2063``` 2064 2065**Description** 2066 2067Sets distributed database tables. 2068 2069**Since**: 11 2070 2071**Parameters** 2072 2073| Name| Description| 2074| -------- | -------- | 2075| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2076| tables | Pointer to the names of the distributed tables to set.| 2077| count | Number of distributed database tables to be set.| 2078| type | [Rdb_DistributedType](#rdb_distributedtype).| 2079| config | Configuration of the distributed mode. For details, see [Rdb_DistributedConfig](_rdb___distributed_config.md).| 2080 2081**Returns** 2082 2083Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 2084 2085**See** 2086 2087[OH_Rdb_Store](_o_h___rdb___store.md). 2088 2089 2090### OH_Rdb_SetVersion() 2091 2092``` 2093int OH_Rdb_SetVersion (OH_Rdb_Store *store, int version ) 2094``` 2095 2096**Description** 2097 2098Sets the RDB store version. 2099 2100**Since**: 10 2101 2102**Parameters** 2103 2104| Name| Description| 2105| -------- | -------- | 2106| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2107| version | Version to set.| 2108 2109**Returns** 2110 2111Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 2112 2113**See** 2114 2115[OH_Rdb_Store](_o_h___rdb___store.md). 2116 2117 2118### OH_Rdb_Subscribe() 2119 2120``` 2121int OH_Rdb_Subscribe (OH_Rdb_Store *store, Rdb_SubscribeType type, const Rdb_DataObserver *observer ) 2122``` 2123 2124**Description** 2125 2126Registers an observer for an RDB store. When data in the RDB store changes, a callback will be invoked to return the data changes. 2127 2128**Since**: 11 2129 2130**Parameters** 2131 2132| Name| Description| 2133| -------- | -------- | 2134| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2135| type | Subscription type defined in [Rdb_SubscribeType](#rdb_subscribetype).| 2136| observer | Pointer to the [Rdb_DataObserver](_rdb___data_observer.md) instance.| 2137 2138**Returns** 2139 2140Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 2141 2142**See** 2143 2144[OH_Rdb_Store](_o_h___rdb___store.md). 2145 2146[Rdb_DataObserver](_rdb___data_observer.md). 2147 2148 2149### OH_Rdb_SubscribeAutoSyncProgress() 2150 2151``` 2152int OH_Rdb_SubscribeAutoSyncProgress (OH_Rdb_Store *store, const Rdb_ProgressObserver *observer ) 2153``` 2154 2155**Description** 2156 2157Subscribes to the automatic sync progress of an RDB store. The registered callback will be invoked to return the automatic sync progress. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 2158 2159**Since**: 11 2160 2161**Parameters** 2162 2163| Name| Description| 2164| -------- | -------- | 2165| store | Pointer to the target [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2166| observer | Pointer to the [Rdb_ProgressObserver](_rdb___progress_observer.md) instance, which invokes the callback to return the automatic sync progress.| 2167 2168**Returns** 2169 2170Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2171 2172**See** 2173 2174[OH_Rdb_Store](_o_h___rdb___store.md). 2175 2176[Rdb_ProgressObserver](_rdb___progress_observer.md). 2177 2178### OH_Rdb_UnlockRow() 2179 2180``` 2181int OH_Rdb_UnlockRow (OH_Rdb_Store *store, OH_Predicates *predicates ) 2182``` 2183 2184**Description** 2185 2186Unlocks data in an RDB store based on the specified conditions. 2187 2188**Since**: 12 2189 2190**Parameters** 2191 2192| Name| Description| 2193| -------- | -------- | 2194| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2195| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance, which specifies the unlock conditions.| 2196 2197**Returns** 2198 2199Result of the unlock operation. 2200 2201**See** 2202 2203[OH_Rdb_Store](_o_h___rdb___store.md), [OH_Predicates](_o_h___predicates.md). 2204 2205### OH_Rdb_Unsubscribe() 2206 2207``` 2208int OH_Rdb_Unsubscribe (OH_Rdb_Store *store, Rdb_SubscribeType type, const Rdb_DataObserver *observer ) 2209``` 2210 2211**Description** 2212 2213Unregisters the observer of the specified type. 2214 2215**Since**: 11 2216 2217**Parameters** 2218 2219| Name| Description| 2220| -------- | -------- | 2221| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2222| type | Subscription type defined in [Rdb_SubscribeType](#rdb_subscribetype).| 2223| observer | Pointer to the [Rdb_DataObserver](_rdb___data_observer.md) instance. If this parameter is **nullptr**, all observers of this type will be unregistered.| 2224 2225**Returns** 2226 2227Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 2228 2229**See** 2230 2231[OH_Rdb_Store](_o_h___rdb___store.md). 2232 2233[Rdb_DataObserver](_rdb___data_observer.md). 2234 2235 2236### OH_Rdb_UnsubscribeAutoSyncProgress() 2237 2238``` 2239int OH_Rdb_UnsubscribeAutoSyncProgress (OH_Rdb_Store *store, const Rdb_ProgressObserver *observer ) 2240``` 2241 2242**Description** 2243 2244Unsubscribes from the automatic sync process of an RDB store. 2245 2246**Since**: 11 2247 2248**Parameters** 2249 2250| Name| Description| 2251| -------- | -------- | 2252| store | Pointer to the target [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2253| observer | Pointer to [Rdb_ProgressObserver](_rdb___progress_observer.md). If the pointer is null, all callbacks for the automatic sync process will be unregistered.| 2254 2255**Returns** 2256 2257Returns **RDB_OK** if the operation is successful; returns an error code otherwise. <br>**RDB_OK** indicates the operation is successful. <br>**RDB_E_INVALID_ARGS** indicates invalid parameters are specified. 2258 2259**See** 2260 2261[OH_Rdb_Store](_o_h___rdb___store.md). 2262 2263[Rdb_ProgressObserver](_rdb___progress_observer.md). 2264 2265 2266### OH_Rdb_Update() 2267 2268``` 2269int OH_Rdb_Update (OH_Rdb_Store *store, OH_VBucket *valuesBucket, OH_Predicates *predicates ) 2270``` 2271 2272**Description** 2273 2274Updates data in an RDB store based on specified conditions. 2275 2276**Since**: 10 2277 2278**Parameters** 2279 2280| Name| Description| 2281| -------- | -------- | 2282| store | Pointer to the [OH_Rdb_Store](_o_h___rdb___store.md) instance.| 2283| valuesBucket | Pointer to the new data [OH_VBucket](_o_h___v_bucket.md) to be updated to the table.| 2284| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance, specifying the update conditions.| 2285 2286**Returns** 2287 2288Returns the number of affected rows if the operation is successful; returns an error code otherwise. 2289 2290**See** 2291 2292[OH_Rdb_Store](_o_h___rdb___store.md), [OH_Bucket](_o_h___v_bucket.md), [OH_Predicates](_o_h___predicates.md). 2293 2294 2295### OH_VBucket_PutAsset() 2296 2297``` 2298int OH_VBucket_PutAsset (OH_VBucket *bucket, const char *field, OH_Asset *value ) 2299``` 2300 2301**Description** 2302 2303Puts an **OH_Asset** object into the [OH_VBucket](_o_h___v_bucket.md) object with the given column name. 2304 2305**Since**: 11 2306 2307**Parameters** 2308 2309| Name| Description| 2310| -------- | -------- | 2311| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.| 2312| field | Pointer to the column name in the database table.| 2313| value | Pointer to the value to put.| 2314 2315**Returns** 2316 2317Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2318 2319**See** 2320 2321[OH_VBucket](_o_h___v_bucket.md). 2322 2323 2324### OH_VBucket_PutAssets() 2325 2326``` 2327int OH_VBucket_PutAssets (OH_VBucket *bucket, const char *field, OH_Asset **value, int count ) 2328``` 2329 2330**Description** 2331 2332Puts an array of **OH_Asset** objects into the [OH_VBucket](_o_h___v_bucket.md) object with the given column name. 2333 2334**Since**: 11 2335 2336**Parameters** 2337 2338| Name| Description| 2339| -------- | -------- | 2340| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.| 2341| field | Pointer to the column name in the database table.| 2342| value | Pointer to the value to put.| 2343| count | Number of elements in the **OH_Asset** object array.| 2344 2345**Returns** 2346 2347Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2348 2349**See** 2350 2351[OH_VBucket](_o_h___v_bucket.md). 2352 2353## Variable Description 2354 2355 2356### andOperate 2357 2358``` 2359OH_Predicates *(*andOperate) (OH_Predicates *predicates) 2360``` 2361 2362**Description** 2363 2364Pointer to the function used to add the AND operator to the predicates. 2365 2366This method is equivalent to **AND** in SQL statements. 2367 2368**Since**: 10 2369 2370**Parameters** 2371 2372| Name| Description| 2373| -------- | -------- | 2374| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 2375 2376**Returns** 2377 2378Returns the predicates with the AND operator. 2379 2380**See** 2381 2382[OH_Predicates](_o_h___predicates.md). 2383 2384 2385### area 2386 2387``` 2388int OH_Rdb_Config::area 2389``` 2390 2391**Description** 2392 2393Pointer to the function used to set [Rdb_SecurityArea](#rdb_securityarea). 2394 2395**Since**: 11 2396 2397 2398### beginWrap 2399 2400``` 2401OH_Predicates *(*beginWrap) (OH_Predicates *predicates) 2402``` 2403 2404**Description** 2405 2406Pointer to the function used to add a left parenthesis to the predicates. 2407 2408This method is equivalent to "(" in SQL statements. 2409 2410**Since**: 10 2411 2412**Parameters** 2413 2414| Name| Description| 2415| -------- | -------- | 2416| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 2417 2418**Returns** 2419 2420Returns the predicates with a left parenthesis. 2421 2422**See** 2423 2424[OH_Predicates](_o_h___predicates.md). 2425 2426 2427### between 2428 2429``` 2430OH_Predicates *(*between) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 2431``` 2432 2433**Description** 2434 2435Pointer to the function used to set a predicates object to match the field whose value is within the specified range. 2436 2437This method is equivalent to **BETWEEN** in SQL statements. 2438 2439**Since**: 10 2440 2441**Parameters** 2442 2443| Name| Description| 2444| -------- | -------- | 2445| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 2446| field | Pointer to the column name in the database table.| 2447| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the start and end values.| 2448 2449**Returns** 2450 2451Returns the predicates created. 2452 2453**See** 2454 2455[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 2456 2457 2458### briefObserver 2459 2460``` 2461Rdb_BriefObserver Rdb_SubscribeCallback::briefObserver 2462``` 2463 2464**Description** 2465 2466Callback used to return the device-cloud data change event. 2467 2468 2469### bundleName 2470 2471``` 2472const char* OH_Rdb_Config::bundleName 2473``` 2474 2475**Description** 2476 2477Bundle name. 2478 2479 2480### callback [1/2] 2481 2482``` 2483Rdb_SubscribeCallback Rdb_DataObserver::callback 2484``` 2485 2486**Description** 2487 2488Callback of the data observer. 2489 2490 2491### callback [2/2] 2492 2493``` 2494Rdb_ProgressCallback Rdb_ProgressObserver::callback 2495``` 2496 2497**Description** 2498 2499Callback used to return the device-cloud sync progress. 2500 2501 2502### capability 2503 2504``` 2505uint16_t OH_VBucket::capability 2506``` 2507 2508**Description** 2509 2510Number of the KV pairs in the struct. 2511 2512 2513### ChangeType 2514 2515``` 2516int Rdb_ChangeInfo::ChangeType 2517``` 2518 2519**Description** 2520 2521Type of the data changed, which can be data or asset. 2522 2523 2524### clear [1/2] 2525 2526``` 2527OH_Predicates *(*clear) (OH_Predicates *predicates) 2528``` 2529 2530**Description** 2531 2532Pointer to the function used to clear a predicates instance. 2533 2534**Since**: 10 2535 2536**Parameters** 2537 2538| Name| Description| 2539| -------- | -------- | 2540| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 2541 2542**Returns** 2543 2544Returns the cleared predicates. 2545 2546**See** 2547 2548[OH_Predicates](_o_h___predicates.md). 2549 2550 2551### clear [2/2] 2552 2553``` 2554int(*clear) (OH_VBucket *bucket) 2555``` 2556 2557**Description** 2558 2559Pointer to the function used to clear an [OH_VBucket](_o_h___v_bucket.md) object. 2560 2561**Since**: 10 2562 2563**Parameters** 2564 2565| Name| Description| 2566| -------- | -------- | 2567| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.| 2568 2569**Returns** 2570 2571Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2572 2573**See** 2574 2575[OH_VBucket](_o_h___v_bucket.md). 2576 2577 2578### code 2579 2580``` 2581int Rdb_ProgressDetails::code 2582``` 2583 2584**Description** 2585 2586Device-cloud sync state. 2587 2588 2589### context [1/2] 2590 2591``` 2592void* Rdb_DataObserver::context 2593``` 2594 2595**Description** 2596 2597Context of the data observer. 2598 2599 2600### context [2/2] 2601 2602``` 2603void* Rdb_ProgressObserver::context 2604``` 2605 2606**Description** 2607 2608Context of the device-cloud sync progress observer. 2609 2610 2611### count 2612 2613``` 2614int Rdb_KeyInfo::count 2615``` 2616 2617**Description** 2618 2619Number of the changed primary keys or row numbers. 2620 2621 2622### dataBaseDir 2623 2624``` 2625const char* OH_Rdb_Config::dataBaseDir 2626``` 2627 2628**Description** 2629 2630Path of the database file. 2631 2632 2633### deleted 2634 2635``` 2636Rdb_KeyInfo Rdb_ChangeInfo::deleted 2637``` 2638 2639**Description** 2640 2641Location 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. 2642 2643 2644### destroy [1/4] 2645 2646``` 2647int(*destroy) (OH_Cursor *cursor) 2648``` 2649 2650**Description** 2651 2652Pointer to the function used to destroy a result set. 2653 2654**Since**: 10 2655 2656**Parameters** 2657 2658| Name| Description| 2659| -------- | -------- | 2660| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 2661 2662**Returns** 2663 2664Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2665 2666**See** 2667 2668[OH_Cursor](_o_h___cursor.md). 2669 2670 2671### destroy [2/4] 2672 2673``` 2674int(*destroy) (OH_Predicates *predicates) 2675``` 2676 2677**Description** 2678 2679Pointer to the function used to destroy an [OH_Predicates](_o_h___predicates.md) object to reclaim the memory occupied. 2680 2681**Since**: 10 2682 2683**Parameters** 2684 2685| Name| Description| 2686| -------- | -------- | 2687| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 2688 2689**Returns** 2690 2691Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2692 2693**See** 2694 2695[OH_Predicates](_o_h___predicates.md). 2696 2697 2698### destroy [3/4] 2699 2700``` 2701int(*destroy) (OH_VBucket *bucket) 2702``` 2703 2704**Description** 2705 2706Pointer to the function used to destroy an [OH_VBucket](_o_h___v_bucket.md) object to reclaim the memory occupied. 2707 2708**Since**: 10 2709 2710**Parameters** 2711 2712| Name| Description| 2713| -------- | -------- | 2714| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.| 2715 2716**Returns** 2717 2718Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2719 2720**See** 2721 2722[OH_VBucket](_o_h___v_bucket.md). 2723 2724 2725### destroy [4/4] 2726 2727``` 2728int(*destroy) (OH_VObject *valueObject) 2729``` 2730 2731**Description** 2732 2733Pointer to the function used to destroy an [OH_VObject](_o_h___v_object.md) object to reclaim the memory occupied. 2734 2735**Since**: 10 2736 2737**Parameters** 2738 2739| Name| Description| 2740| -------- | -------- | 2741| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.| 2742 2743**Returns** 2744 2745Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2746 2747**See** 2748 2749[OH_VObject](_o_h___v_object.md). 2750 2751 2752### detailsObserver 2753 2754``` 2755Rdb_DetailsObserver Rdb_SubscribeCallback::detailsObserver 2756``` 2757 2758**Description** 2759 2760Callback used to return the details about the device-cloud data change. 2761 2762 2763### distinct 2764 2765``` 2766OH_Predicates *(*distinct) (OH_Predicates *predicates) 2767``` 2768 2769**Description** 2770 2771Pointer to the function used to set a predicates object to filter out duplicate records. 2772 2773This method is equivalent to **DISTINCT** in SQL statements. 2774 2775**Since**: 10 2776 2777**Parameters** 2778 2779| Name| Description| 2780| -------- | -------- | 2781| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 2782 2783**Returns** 2784 2785Returns the predicates created. 2786 2787**See** 2788 2789[OH_Predicates](_o_h___predicates.md). 2790 2791 2792### download 2793 2794``` 2795Rdb_Statistic Rdb_TableDetails::download 2796``` 2797 2798**Description** 2799 2800Statistics of the device-cloud download tasks. 2801 2802 2803### endWrap 2804 2805``` 2806OH_Predicates *(*endWrap) (OH_Predicates *predicates) 2807``` 2808 2809**Description** 2810 2811Pointer to the function used to add a right parenthesis to the predicates. 2812 2813This method is equivalent to ")" in SQL statements. 2814 2815**Since**: 10 2816 2817**Parameters** 2818 2819| Name| Description| 2820| -------- | -------- | 2821| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 2822 2823**Returns** 2824 2825Returns the predicates object with a right parenthesis. 2826 2827**See** 2828 2829[OH_Predicates](_o_h___predicates.md). 2830 2831 2832### equalTo 2833 2834``` 2835OH_Predicates *(*equalTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 2836``` 2837 2838**Description** 2839 2840Pointer to the function used to set a predicates object to match the field whose value is equal to the specified value. 2841 2842This method is equivalent to "=" in SQL statements. 2843 2844**Since**: 10 2845 2846**Parameters** 2847 2848| Name| Description| 2849| -------- | -------- | 2850| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 2851| field | Pointer to the column name in the database table.| 2852| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.| 2853 2854**Returns** 2855 2856Returns the predicates created. 2857 2858**See** 2859 2860[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 2861 2862 2863### failed 2864 2865``` 2866int Rdb_Statistic::failed 2867``` 2868 2869**Description** 2870 2871Number of rows that failed to be synced between the device and cloud in the database table. 2872 2873 2874### getAsset 2875 2876``` 2877int(*getAsset) (OH_Cursor *cursor, int32_t columnIndex, Data_Asset *value) 2878``` 2879 2880**Description** 2881 2882Pointer to the function used to obtain the value of the asset type based on the specified column and the current row. 2883 2884**Since**: 11 2885 2886**Parameters** 2887 2888| Name| Description| 2889| -------- | -------- | 2890| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 2891| columnIndex | Index of the column. The index value starts from **0**.| 2892| value | Pointer to the value obtained.| 2893 2894**Returns** 2895 2896Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2897 2898**See** 2899 2900[OH_Cursor](_o_h___cursor.md). 2901 2902 2903### getAssets 2904 2905``` 2906int(*getAssets) (OH_Cursor *cursor, int32_t columnIndex, Data_Asset **value, uint32_t length) 2907``` 2908 2909**Description** 2910 2911Pointer to the function used to obtain the values in the form of an asset array based on the specified column and the current row. 2912 2913**Since**: 11 2914 2915**Parameters** 2916 2917| Name| Description| 2918| -------- | -------- | 2919| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 2920| columnIndex | Index of the column. The index value starts from **0**.| 2921| value | Pointer to the value obtained.| 2922| length | Length of an asset array.| 2923 2924**Returns** 2925 2926Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2927 2928**See** 2929 2930[OH_Cursor](_o_h___cursor.md). 2931 2932 2933### getBlob 2934 2935``` 2936int(*getBlob) (OH_Cursor *cursor, int32_t columnIndex, unsigned char *value, int length) 2937``` 2938 2939**Description** 2940 2941Pointer to the function used to obtain the values in the form of a byte array based on the specified column and the current row. 2942 2943**Since**: 10 2944 2945**Parameters** 2946 2947| Name| Description| 2948| -------- | -------- | 2949| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 2950| columnIndex | Index of the column. The index value starts from **0**.| 2951| value | Pointer to the values in the form of a byte array obtained.| 2952| length | Length of the value, which can be obtained by **getSize()**.| 2953 2954**Returns** 2955 2956Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2957 2958**See** 2959 2960[OH_Cursor](_o_h___cursor.md). 2961 2962 2963### getColumnCount 2964 2965``` 2966int(*getColumnCount) (OH_Cursor *cursor, int *count) 2967``` 2968 2969**Description** 2970 2971Pointer to the function used to obtain the number of columns in the result set. 2972 2973**Since**: 10 2974 2975**Parameters** 2976 2977| Name| Description| 2978| -------- | -------- | 2979| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 2980| count | Pointer to the number of columns in the result set obtained.| 2981 2982**Returns** 2983 2984Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 2985 2986**See** 2987 2988[OH_Cursor](_o_h___cursor.md). 2989 2990 2991### getColumnIndex 2992 2993``` 2994int(*getColumnIndex) (OH_Cursor *cursor, const char *name, int *columnIndex) 2995``` 2996 2997**Description** 2998 2999Pointer to the function used to obtain the column index based on the specified column name. 3000 3001**Since**: 10 3002 3003**Parameters** 3004 3005| Name| Description| 3006| -------- | -------- | 3007| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3008| name | Pointer to the column name in the result set.| 3009| columnIndex | Pointer to the column index obtained.| 3010 3011**Returns** 3012 3013Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3014 3015**See** 3016 3017[OH_Cursor](_o_h___cursor.md). 3018 3019 3020### getColumnName 3021 3022``` 3023int(*getColumnName) (OH_Cursor *cursor, int32_t columnIndex, char *name, int length) 3024``` 3025 3026**Description** 3027 3028Pointer to the function used to obtain the column name based on the specified column index. 3029 3030**Since**: 10 3031 3032**Parameters** 3033 3034| Name| Description| 3035| -------- | -------- | 3036| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3037| columnIndex | Index of the column. The index value starts from **0**.| 3038| name | Pointer to the column name obtained.| 3039| length | Length of a column name.| 3040 3041**Returns** 3042 3043Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3044 3045**See** 3046 3047[OH_Cursor](_o_h___cursor.md). 3048 3049 3050### getColumnType 3051 3052``` 3053int(*getColumnType) (OH_Cursor *cursor, int32_t columnIndex, OH_ColumnType *columnType) 3054``` 3055 3056**Description** 3057 3058Pointer to the function used to obtain the column type based on the specified column index. 3059 3060**Since**: 10 3061 3062**Parameters** 3063 3064| Name| Description| 3065| -------- | -------- | 3066| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3067| columnIndex | Index of the column. The index value starts from **0**.| 3068| columnType | Pointer to the [OH_ColumnType](#oh_columntype) obtained.| 3069 3070**Returns** 3071 3072Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3073 3074**See** 3075 3076[OH_Cursor](_o_h___cursor.md), [OH_ColumnType](#oh_columntype). 3077 3078 3079### getInt64 3080 3081``` 3082int(*getInt64) (OH_Cursor *cursor, int32_t columnIndex, int64_t *value) 3083``` 3084 3085**Description** 3086 3087Pointer to the function used to obtain the value of the int64_t type based on the specified column and the current row. 3088 3089**Since**: 10 3090 3091**Parameters** 3092 3093| Name| Description| 3094| -------- | -------- | 3095| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3096| columnIndex | Index of the column. The index value starts from **0**.| 3097| value | Pointer to the value obtained.| 3098 3099**Returns** 3100 3101Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3102 3103**See** 3104 3105[OH_Cursor](_o_h___cursor.md). 3106 3107 3108### getReal 3109 3110``` 3111int(*getReal) (OH_Cursor *cursor, int32_t columnIndex, double *value) 3112``` 3113 3114**Description** 3115 3116Pointer to the function used to obtain the value of the double type based on the specified column and the current row. 3117 3118**Since**: 10 3119 3120**Parameters** 3121 3122| Name| Description| 3123| -------- | -------- | 3124| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3125| columnIndex | Index of the column. The index value starts from **0**.| 3126| value | Pointer to the value obtained.| 3127 3128**Returns** 3129 3130Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3131 3132**See** 3133 3134[OH_Cursor](_o_h___cursor.md). 3135 3136 3137### getRowCount 3138 3139``` 3140int(*getRowCount) (OH_Cursor *cursor, int *count) 3141``` 3142 3143**Description** 3144 3145Pointer to the function used to obtain the number of rows in the result set. 3146 3147**Since**: 10 3148 3149**Parameters** 3150 3151| Name| Description| 3152| -------- | -------- | 3153| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3154| count | Pointer to the number of columns in the result set obtained.| 3155 3156**Returns** 3157 3158Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3159 3160**See** 3161 3162[OH_Cursor](_o_h___cursor.md). 3163 3164 3165### getSize 3166 3167``` 3168int(*getSize) (OH_Cursor *cursor, int32_t columnIndex, size_t *size) 3169``` 3170 3171**Description** 3172 3173Pointer to the function used to obtain information about the memory required when the column data type in the result set is **BLOB** or **TEXT**. 3174 3175**Since**: 10 3176 3177**Parameters** 3178 3179| Name| Description| 3180| -------- | -------- | 3181| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3182| columnIndex | Index of the column. The index value starts from **0**.| 3183| size | Pointer to the memory size obtained.| 3184 3185**Returns** 3186 3187Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3188 3189**See** 3190 3191[OH_Cursor](_o_h___cursor.md). 3192 3193 3194### getText 3195 3196``` 3197int(*getText) (OH_Cursor *cursor, int32_t columnIndex, char *value, int length) 3198``` 3199 3200**Description** 3201 3202Pointer to the function used to obtain the value of the string type based on the specified column and the current row. 3203 3204**Since**: 10 3205 3206**Parameters** 3207 3208| Name| Description| 3209| -------- | -------- | 3210| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3211| columnIndex | Index of the column. The index value starts from **0**.| 3212| value | Pointer to the value of the string type obtained.| 3213| length | Length of the value, which can be obtained by **getSize()**.| 3214 3215**Returns** 3216 3217Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3218 3219**See** 3220 3221[OH_Cursor](_o_h___cursor.md). 3222 3223 3224### goToNextRow 3225 3226``` 3227int(*goToNextRow) (OH_Cursor *cursor) 3228``` 3229 3230**Description** 3231 3232Pointer to the function used to go to the next row of the result set. 3233 3234**Since**: 10 3235 3236**Parameters** 3237 3238| Name| Description| 3239| -------- | -------- | 3240| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3241 3242**Returns** 3243 3244Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3245 3246**See** 3247 3248[OH_Cursor](_o_h___cursor.md). 3249 3250 3251### greaterThan 3252 3253``` 3254OH_Predicates *(*greaterThan) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 3255``` 3256 3257**Description** 3258 3259Pointer to the function used to set a predicates object to match the field with value greater than the specified value. 3260 3261This method is equivalent to ">" in SQL statements. 3262 3263**Since**: 10 3264 3265**Parameters** 3266 3267| Name| Description| 3268| -------- | -------- | 3269| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3270| field | Pointer to the column name in the database table.| 3271| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.| 3272 3273**Returns** 3274 3275Returns the predicates created. 3276 3277**See** 3278 3279[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 3280 3281 3282### greaterThanOrEqualTo 3283 3284``` 3285OH_Predicates *(*greaterThanOrEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 3286``` 3287 3288**Description** 3289 3290Pointer to the function used to set a predicates object to match the field with value greater than or equal to the specified value. 3291 3292This method is equivalent to ">=" in SQL statements. 3293 3294**Since**: 10 3295 3296**Parameters** 3297 3298| Name| Description| 3299| -------- | -------- | 3300| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3301| field | Pointer to the column name in the database table.| 3302| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.| 3303 3304**Returns** 3305 3306Returns the predicates created. 3307 3308**See** 3309 3310[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 3311 3312 3313### groupBy 3314 3315``` 3316OH_Predicates *(*groupBy) (OH_Predicates *predicates, char const *const *fields, int length) 3317``` 3318 3319**Description** 3320 3321Pointer to the function used to set a predicates object to group rows that have the same value into summary rows. 3322 3323This method is equivalent to **GROUP BY** in SQL statements. 3324 3325**Since**: 10 3326 3327**Parameters** 3328 3329| Name| Description| 3330| -------- | -------- | 3331| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3332| fields | Pointer to the names of the columns by which the records are grouped.| 3333| length | Length of the **fields** value.| 3334 3335**Returns** 3336 3337Returns the predicates created. 3338 3339**See** 3340 3341[OH_Predicates](_o_h___predicates.md). 3342 3343 3344### id [1/5] 3345 3346``` 3347int64_t OH_Cursor::id 3348``` 3349 3350**Description** 3351 3352Unique identifier of the **OH_Cursor** struct. 3353 3354 3355### id [2/5] 3356 3357``` 3358int64_t OH_Predicates::id 3359``` 3360 3361**Description** 3362 3363Unique identifier of the **OH_Predicates** struct. 3364 3365 3366### id [3/5] 3367 3368``` 3369int64_t OH_VObject::id 3370``` 3371 3372**Description** 3373 3374Unique identifier of the **OH_VObject** struct. 3375 3376 3377### id [4/5] 3378 3379``` 3380int64_t OH_VBucket::id 3381``` 3382 3383**Description** 3384 3385Unique identifier of the **OH_VBucket** struct. 3386 3387 3388### id [5/5] 3389 3390``` 3391int64_t OH_Rdb_Store::id 3392``` 3393 3394**Description** 3395 3396Unique identifier of the **OH_Rdb_Store** struct. 3397 3398 3399### in 3400 3401``` 3402OH_Predicates *(*in) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 3403``` 3404 3405**Description** 3406 3407Pointer to the function used to set a predicates object to match the field with the value within the specified range. 3408 3409This method is equivalent to **IN** in SQL statements. 3410 3411**Since**: 10 3412 3413**Parameters** 3414 3415| Name| Description| 3416| -------- | -------- | 3417| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3418| field | Pointer to the column name in the database table.| 3419| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value range.| 3420 3421**Returns** 3422 3423Returns the predicates created. 3424 3425**See** 3426 3427[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 3428 3429 3430### inserted 3431 3432``` 3433Rdb_KeyInfo Rdb_ChangeInfo::inserted 3434``` 3435 3436**Description** 3437 3438Location 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. 3439 3440 3441### integer 3442 3443``` 3444uint64_t Rdb_KeyInfo::Rdb_KeyData::integer 3445``` 3446 3447**Description** 3448 3449Data of the uint64_t type. 3450 3451 3452### isAutoSync 3453 3454``` 3455bool Rdb_DistributedConfig::isAutoSync 3456``` 3457 3458**Description** 3459 3460Whether the table supports automatic sync. 3461 3462 3463### isEncrypt 3464 3465``` 3466bool OH_Rdb_Config::isEncrypt 3467``` 3468 3469**Description** 3470 3471Whether to encrypt the RDB store. 3472 3473 3474### isNotNull 3475 3476``` 3477OH_Predicates *(*isNotNull) (OH_Predicates *predicates, const char *field) 3478``` 3479 3480**Description** 3481 3482Pointer to the function used to set a predicates object to match the field whose value is not null. 3483 3484This method is equivalent to **IS NOT NULL** in SQL statements. 3485 3486**Since**: 10 3487 3488**Parameters** 3489 3490| Name| Description| 3491| -------- | -------- | 3492| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3493| field | Pointer to the column name in the database table.| 3494 3495**Returns** 3496 3497Returns the predicates created. 3498 3499**See** 3500 3501[OH_Predicates](_o_h___predicates.md). 3502 3503 3504### isNull [1/2] 3505 3506``` 3507int(*isNull) (OH_Cursor *cursor, int32_t columnIndex, bool *isNull) 3508``` 3509 3510**Description** 3511 3512Pointer to the function used to check whether the value in the specified column is null. 3513 3514**Since**: 10 3515 3516**Parameters** 3517 3518| Name| Description| 3519| -------- | -------- | 3520| cursor | Pointer to the [OH_Cursor](_o_h___cursor.md) instance.| 3521| columnIndex | Index of the column. The index value starts from **0**.| 3522| isNull | Pointer to the value returned. The value **true** means the value is null; the value **false** means the opposite.| 3523 3524**Returns** 3525 3526Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3527 3528**See** 3529 3530[OH_Cursor](_o_h___cursor.md). 3531 3532 3533### isNull [2/2] 3534 3535``` 3536OH_Predicates *(*isNull) (OH_Predicates *predicates, const char *field) 3537``` 3538 3539**Description** 3540 3541Pointer to the function used to set a predicates object to match the field whose value is null. 3542 3543This method is equivalent to **IS NULL** in SQL statements. 3544 3545**Since**: 10 3546 3547**Parameters** 3548 3549| Name| Description| 3550| -------- | -------- | 3551| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3552| field | Pointer to the column name in the database table.| 3553 3554**Returns** 3555 3556Returns the predicates created. 3557 3558**See** 3559 3560[OH_Predicates](_o_h___predicates.md). 3561 3562 3563### lessThan 3564 3565``` 3566OH_Predicates *(*lessThan) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 3567``` 3568 3569**Description** 3570 3571Pointer to the function used to set a predicates object to match the field with value less than the specified value. 3572 3573This method is equivalent to "<" in SQL statements. 3574 3575**Since**: 10 3576 3577**Parameters** 3578 3579| Name| Description| 3580| -------- | -------- | 3581| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3582| field | Pointer to the column name in the database table.| 3583| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.| 3584 3585**Returns** 3586 3587Returns the predicates created. 3588 3589**See** 3590 3591[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 3592 3593 3594### lessThanOrEqualTo 3595 3596``` 3597OH_Predicates *(*lessThanOrEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 3598``` 3599 3600**Description** 3601 3602Pointer to the function used to set a predicates object to match the field with value less than or equal to the specified value. 3603 3604This method is equivalent to "<=" in SQL statements. 3605 3606**Since**: 10 3607 3608**Parameters** 3609 3610| Name| Description| 3611| -------- | -------- | 3612| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3613| field | Pointer to the column name in the database table.| 3614| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.| 3615 3616**Returns** 3617 3618Returns the predicates created. 3619 3620**See** 3621 3622[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 3623 3624 3625### like 3626 3627``` 3628OH_Predicates *(*like) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 3629``` 3630 3631**Description** 3632 3633Pointer to the function used to set a predicates object to match a string that is similar to the specified value. 3634 3635This method is equivalent to **LIKE** in SQL statements. 3636 3637**Since**: 10 3638 3639**Parameters** 3640 3641| Name| Description| 3642| -------- | -------- | 3643| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3644| field | Pointer to the column name in the database table.| 3645| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.| 3646 3647**Returns** 3648 3649Returns the predicates created. 3650 3651**See** 3652 3653[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 3654 3655 3656### limit 3657 3658``` 3659OH_Predicates *(*limit) (OH_Predicates *predicates, unsigned int value) 3660``` 3661 3662**Description** 3663 3664Pointer to the function used to set a predicates object to specify the maximum number of records. 3665 3666This method is equivalent to **LIMIT** in SQL statements. 3667 3668**Since**: 10 3669 3670**Parameters** 3671 3672| Name| Description| 3673| -------- | -------- | 3674| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3675| value | Maximum number of data records.| 3676 3677**Returns** 3678 3679Returns the predicates created. 3680 3681**See** 3682 3683[OH_Predicates](_o_h___predicates.md). 3684 3685 3686### moduleName 3687 3688``` 3689const char* OH_Rdb_Config::moduleName 3690``` 3691 3692**Description** 3693 3694Module name. 3695 3696 3697### notBetween 3698 3699``` 3700OH_Predicates *(*notBetween) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 3701``` 3702 3703**Description** 3704 3705Pointer to the function used to set a predicates object to match the field whose value is out of the specified range. 3706 3707This method is equivalent to **NOT BETWEEN** in SQL statements. 3708 3709**Since**: 10 3710 3711**Parameters** 3712 3713| Name| Description| 3714| -------- | -------- | 3715| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3716| field | Pointer to the column name in the database table.| 3717| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the range. | 3718 3719**Returns** 3720 3721Returns the predicates created. 3722 3723**See** 3724 3725[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 3726 3727 3728### notEqualTo 3729 3730``` 3731OH_Predicates *(*notEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 3732``` 3733 3734**Description** 3735 3736Pointer to the function used to set a predicates object to match the field whose value is not equal to the specified value. 3737 3738This method is equivalent to "!=" in SQL statements. 3739 3740**Since**: 10 3741 3742**Parameters** 3743 3744| Name| Description| 3745| -------- | -------- | 3746| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3747| field | Pointer to the column name in the database table.| 3748| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value to match.| 3749 3750**Returns** 3751 3752Returns the predicates created. 3753 3754**See** 3755 3756[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 3757 3758 3759### notIn 3760 3761``` 3762OH_Predicates *(*notIn) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject) 3763``` 3764 3765**Description** 3766 3767Pointer to the function used to set a predicates object to match the field with the value out of the specified range. 3768 3769This method is equivalent to **NOT IN** in SQL statements. 3770 3771**Since**: 10 3772 3773**Parameters** 3774 3775| Name| Description| 3776| -------- | -------- | 3777| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3778| field | Pointer to the column name in the database table.| 3779| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance, which specifies the value range to match.| 3780 3781**Returns** 3782 3783Returns the predicates created. 3784 3785**See** 3786 3787[OH_Predicates](_o_h___predicates.md), [OH_VObject](_o_h___v_object.md). 3788 3789 3790### offset 3791 3792``` 3793OH_Predicates *(*offset) (OH_Predicates *predicates, unsigned int rowOffset) 3794``` 3795 3796**Description** 3797 3798Pointer to the function used to set a predicates object to specify the start position of the returned result. 3799 3800This method is equivalent to **OFFSET** in SQL statements. 3801 3802**Since**: 10 3803 3804**Parameters** 3805 3806| Name| Description| 3807| -------- | -------- | 3808| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3809| rowOffset | Start position of the returned result. The value is a positive integer.| 3810 3811**Returns** 3812 3813Returns the predicates created. 3814 3815**See** 3816 3817[OH_Predicates](_o_h___predicates.md). 3818 3819 3820### orderBy 3821 3822``` 3823OH_Predicates *(*orderBy) (OH_Predicates *predicates, const char *field, OH_OrderType type) 3824``` 3825 3826**Description** 3827 3828Pointer to the function used to set a predicates object to sort the values in a column in ascending or descending order. 3829 3830This method is equivalent to **ORDER BY** in SQL statements. 3831 3832**Since**: 10 3833 3834**Parameters** 3835 3836| Name| Description| 3837| -------- | -------- | 3838| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3839| field | Pointer to the column name in the database table.| 3840| type | Sorting type [OH_OrderType](#oh_ordertype).| 3841 3842**Returns** 3843 3844Returns the predicates created. 3845 3846**See** 3847 3848[OH_Predicates](_o_h___predicates.md), [OH_OrderType](#oh_ordertype). 3849 3850 3851### orOperate 3852 3853``` 3854OH_Predicates *(*orOperate) (OH_Predicates *predicates) 3855``` 3856 3857**Description** 3858 3859Pointer to the function used to add the OR operator to the predicates. 3860 3861This method is equivalent to **OR** in SQL statements. 3862 3863**Since**: 10 3864 3865**Parameters** 3866 3867| Name| Description| 3868| -------- | -------- | 3869| predicates | Pointer to the [OH_Predicates](_o_h___predicates.md) instance.| 3870 3871**Returns** 3872 3873Returns the predicates with the OR operator. 3874 3875**See** 3876 3877[OH_Predicates](_o_h___predicates.md). 3878 3879 3880### putBlob 3881 3882``` 3883int(*putBlob) (OH_VBucket *bucket, const char *field, const uint8_t *value, uint32_t size) 3884``` 3885 3886**Description** 3887 3888Pointer 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. 3889 3890**Since**: 10 3891 3892**Parameters** 3893 3894| Name| Description| 3895| -------- | -------- | 3896| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.| 3897| field | Pointer to the column name in the database table.| 3898| value | Pointer to the value to put.| 3899| size | Length of the value.| 3900 3901**Returns** 3902 3903Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3904 3905**See** 3906 3907[OH_VBucket](_o_h___v_bucket.md). 3908 3909 3910### putDouble 3911 3912``` 3913int(*putDouble) (OH_VObject *valueObject, double *value, uint32_t count) 3914``` 3915 3916**Description** 3917 3918Pointer 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. 3919 3920**Since**: 10 3921 3922**Parameters** 3923 3924| Name| Description| 3925| -------- | -------- | 3926| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.| 3927| value | Pointer to the data to covert.| 3928| count | If **value** points to a single parameter, **count** is **1**. If **value** points to an array, **count** specifies the length of the array.| 3929 3930**Returns** 3931 3932Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3933 3934**See** 3935 3936[OH_VObject](_o_h___v_object.md). 3937 3938 3939### putInt64 [1/2] 3940 3941``` 3942int(*putInt64) (OH_VBucket *bucket, const char *field, int64_t value) 3943``` 3944 3945**Description** 3946 3947Pointer to the function used to put an int64_t value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column. 3948 3949**Since**: 10 3950 3951**Parameters** 3952 3953| Name| Description| 3954| -------- | -------- | 3955| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.| 3956| field | Pointer to the column name in the database table.| 3957| value | Value to put.| 3958 3959**Returns** 3960 3961Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3962 3963**See** 3964 3965[OH_VBucket](_o_h___v_bucket.md). 3966 3967 3968### putInt64 [2/2] 3969 3970``` 3971int(*putInt64) (OH_VObject *valueObject, int64_t *value, uint32_t count) 3972``` 3973 3974**Description** 3975 3976Pointer 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. 3977 3978**Since**: 10 3979 3980**Parameters** 3981 3982| Name| Description| 3983| -------- | -------- | 3984| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.| 3985| value | Pointer to the data to covert.| 3986| count | If **value** points to a single parameter, **count** is **1**. If **value** points to an array, **count** specifies the length of the array.| 3987 3988**Returns** 3989 3990Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 3991 3992**See** 3993 3994[OH_VObject](_o_h___v_object.md). 3995 3996 3997### putNull 3998 3999``` 4000int(*putNull) (OH_VBucket *bucket, const char *field) 4001``` 4002 4003**Description** 4004 4005Pointer to the function used to put a null value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column. 4006 4007**Since**: 10 4008 4009**Parameters** 4010 4011| Name| Description| 4012| -------- | -------- | 4013| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.| 4014| field | Pointer to the column name in the database table.| 4015 4016**Returns** 4017 4018Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 4019 4020**See** 4021 4022[OH_VBucket](_o_h___v_bucket.md). 4023 4024 4025### putReal 4026 4027``` 4028int(*putReal) (OH_VBucket *bucket, const char *field, double value) 4029``` 4030 4031**Description** 4032 4033Pointer to the function used to put a double value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column. 4034 4035**Since**: 10 4036 4037**Parameters** 4038 4039| Name| Description| 4040| -------- | -------- | 4041| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.| 4042| field | Pointer to the column name in the database table.| 4043| value | Value to put.| 4044 4045**Returns** 4046 4047Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 4048 4049**See** 4050 4051[OH_VBucket](_o_h___v_bucket.md). 4052 4053 4054### putText [1/2] 4055 4056``` 4057int(*putText) (OH_VBucket *bucket, const char *field, const char *value) 4058``` 4059 4060**Description** 4061 4062Pointer to the function used to put a char value into the [OH_VBucket](_o_h___v_bucket.md) object in the given column. 4063 4064**Since**: 10 4065 4066**Parameters** 4067 4068| Name| Description| 4069| -------- | -------- | 4070| bucket | Pointer to the [OH_VBucket](_o_h___v_bucket.md) instance.| 4071| field | Pointer to the column name in the database table.| 4072| value | Pointer to the value to put.| 4073 4074**Returns** 4075 4076Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 4077 4078**See** 4079 4080[OH_VBucket](_o_h___v_bucket.md). 4081 4082 4083### putText [2/2] 4084 4085``` 4086int(*putText) (OH_VObject *valueObject, const char *value) 4087``` 4088 4089**Description** 4090 4091Pointer 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. 4092 4093**Since**: 10 4094 4095**Parameters** 4096 4097| Name| Description| 4098| -------- | -------- | 4099| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.| 4100| value | Pointer to the character array to convert.| 4101 4102**Returns** 4103 4104Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 4105 4106**See** 4107 4108[OH_VObject](_o_h___v_object.md). 4109 4110 4111### putTexts 4112 4113``` 4114int(*putTexts) (OH_VObject *valueObject, const char **value, uint32_t count) 4115``` 4116 4117**Description** 4118 4119Pointer 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. 4120 4121**Since**: 10 4122 4123**Parameters** 4124 4125| Name| Description| 4126| -------- | -------- | 4127| valueObject | Pointer to the [OH_VObject](_o_h___v_object.md) instance.| 4128| value | Pointer to the string array to convert.| 4129| count | Length of the string array to convert.| 4130 4131**Returns** 4132 4133Returns **RDB_OK** if the operation is successful; returns an error code otherwise. 4134 4135**See** 4136 4137[OH_VObject](_o_h___v_object.md). 4138 4139 4140### real 4141 4142``` 4143double Rdb_KeyInfo::Rdb_KeyData::real 4144``` 4145 4146**Description** 4147 4148Data of the double type. 4149 4150 4151### remained 4152 4153``` 4154int Rdb_Statistic::remained 4155``` 4156 4157**Description** 4158 4159Number of rows that are not executed for device-cloud sync in the database table. 4160 4161 4162### schedule 4163 4164``` 4165int Rdb_ProgressDetails::schedule 4166``` 4167 4168**Description** 4169 4170Device-cloud sync process. 4171 4172 4173### securityLevel 4174 4175``` 4176int OH_Rdb_Config::securityLevel 4177``` 4178 4179**Description** 4180 4181RDB store security level. For details, see [OH_Rdb_SecurityLevel](#oh_rdb_securitylevel). 4182 4183 4184### selfSize 4185 4186``` 4187int OH_Rdb_Config::selfSize 4188``` 4189 4190**Description** 4191 4192Size of the struct. 4193 4194 4195### storeName 4196 4197``` 4198const char* OH_Rdb_Config::storeName 4199``` 4200 4201**Description** 4202 4203Name of the RDB store. 4204 4205 4206### successful 4207 4208``` 4209int Rdb_Statistic::successful 4210``` 4211 4212**Description** 4213 4214Number of rows that are successfully synced between the device and cloud in the database table. 4215 4216 4217### table 4218 4219``` 4220const char* Rdb_TableDetails::table 4221``` 4222 4223**Description** 4224 4225Database table name. 4226 4227 4228### tableLength 4229 4230``` 4231int32_t Rdb_ProgressDetails::tableLength 4232``` 4233 4234**Description** 4235 4236Number of the tables synced between the device and cloud. 4237 4238 4239### tableName 4240 4241``` 4242const char* Rdb_ChangeInfo::tableName 4243``` 4244 4245**Description** 4246 4247Name of the table with data changes. 4248 4249 4250### text 4251 4252``` 4253const char* Rdb_KeyInfo::Rdb_KeyData::text 4254``` 4255 4256**Description** 4257 4258Data of the char \* type. 4259 4260 4261### total 4262 4263``` 4264int Rdb_Statistic::total 4265``` 4266 4267**Description** 4268 4269Total number of rows to be synced between the device and cloud in the database table. 4270 4271 4272### type 4273 4274``` 4275int Rdb_KeyInfo::type 4276``` 4277 4278**Description** 4279 4280Type ([OH_ColumnType](#oh_columntype)) of the primary key. 4281 4282 4283### updated 4284 4285``` 4286Rdb_KeyInfo Rdb_ChangeInfo::updated 4287``` 4288 4289**Description** 4290 4291Location 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. 4292 4293 4294### upload 4295 4296``` 4297Rdb_Statistic Rdb_TableDetails::upload 4298``` 4299 4300**Description** 4301 4302Statistics of the device-cloud upload tasks. 4303 4304 4305### version [1/3] 4306 4307``` 4308int Rdb_DistributedConfig::version 4309``` 4310 4311**Description** 4312 4313Version of the **Rdb_DistributedConfig** struct. 4314 4315 4316### version [2/3] 4317 4318``` 4319int Rdb_ChangeInfo::version 4320``` 4321 4322**Description** 4323 4324Version of the **Rdb_DistributedConfig** struct. 4325 4326 4327### version [3/3] 4328 4329``` 4330int Rdb_ProgressDetails::version 4331``` 4332 4333**Description** 4334 4335Version of the **OH_TableDetails** struct. 4336