harmony 鸿蒙RDB

2023-10-30 浏览 (1141)

RDB

Overview

The 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.

@SystemCapability.DistributedDataManager.RelationalStore.Core

Since

10

Summary

Files

NameDescription
oh_cursor.hDefines the APIs for accessing the result set obtained by querying the RDB store.
File to include: <database/rdb/oh_cursor.h>
Library: native_rdb_ndk_header.so
oh_predicates.hDefines the predicates for RDB stores.
File to include: <database/rdb/oh_predicates.h>
Library: native_rdb_ndk_header.so
oh_value_object.hDefines type conversion methods.
File to include: <database/rdb/oh_value_object.h>
Library: native_rdb_ndk_header.so
oh_values_bucket.hDefines the types of the key and value in a key-value (KV) pair.
File to include: <database/rdb/oh_values_bucket.h>
Library: native_rdb_ndk_header.so
relational_store.hDefines the APIs for managing an RDB store.
File to include: <database/rdb/relational_store.h>
Library: native_rdb_ndk_header.so
relational_store_error_code.hDeclares the error codes used for RDB stores.
File to include: <database/rdb/relational_error_code.h>
Library: native_rdb_ndk_header.so

Structs

NameDescription
OH_CursorDefines a result set.
OH_PredicatesDefines a predicates object.
OH_VObjectDefines the allowed data field types.
OH_VBucketDefines the types of the key and value in a KV pair.
OH_Rdb_ConfigDefines the RDB store configuration.
OH_Rdb_StoreDefines the RDB store type.

Types

NameDescription
OH_ColumnTypeEnumerates the field types in an RDB store.
OH_CursorIndicates a result set.
OH_OrderTypeEnumerates the sorting types.
OH_PredicatesIndicates a predicates object.
OH_VObjectIndicates the allowed data field types.
OH_VBucketIndicates the types of the key and value in a KV pair.
OH_Rdb_SecurityLevelEnumerates the RDB store security levels.
OH_Rdb_ErrCodeIndicates error codes.

Enums

NameDescription
OH_ColumnType {
TYPE_NULL = 0, TYPE_INT64, TYPE_REAL, TYPE_TEXT,
TYPE_BLOB
}
Enumerates the field types in an RDB store.
OH_OrderType { ASC = 0, DESC = 1 }Enumerates the sorting types.
OH_Rdb_SecurityLevel { S1 = 1, S2, S3, S4 }Enumerates the RDB store security levels.
OH_Rdb_ErrCode {
RDB_ERR = -1, RDB_OK = 0, E_BASE = 14800000, RDB_E_NOT_SUPPORTED = 801,
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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),
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)
}
Enumerates the RDB store error codes.

Functions

NameDescription
OH_Rdb_CreateValueObject (void)Creates an OH_VObject instance.
OH_Rdb_CreateValuesBucket (void)Creates an OH_VBucket instance.
OH_Rdb_CreatePredicates (const char *table)Creates an OH_Predicates instance.
OH_Rdb_GetOrOpen (const OH_Rdb_Config *config, int *errCode)Obtains an OH_Rdb_Store instance for RDB store operations.
OH_Rdb_CloseStore (OH_Rdb_Store *store)Destroys an OH_Rdb_Store object and reclaims the memory occupied by the object.
OH_Rdb_DeleteStore (const OH_Rdb_Config *config)Deletes an RDB store with the specified database file configuration.
OH_Rdb_Insert (OH_Rdb_Store *store, const char *table, OH_VBucket *valuesBucket)Inserts a row of data into a table.
OH_Rdb_Update (OH_Rdb_Store *store, OH_VBucket *valuesBucket, OH_Predicates *predicates)Updates data in an RDB store based on specified conditions.
OH_Rdb_Delete (OH_Rdb_Store *store, OH_Predicates *predicates)Deletes data from an RDB store based on specified conditions.
OH_Rdb_Query (OH_Rdb_Store *store, OH_Predicates *predicates, const char *const *columnNames, int length)Queries data in an RDB store based on specified conditions.
OH_Rdb_Execute (OH_Rdb_Store *store, const char *sql)Executes an SQL statement but returns no value.
OH_Rdb_ExecuteQuery (OH_Rdb_Store *store, const char *sql)Executes the SQL statement to query data in an RDB store.
OH_Rdb_BeginTransaction (OH_Rdb_Store *store)Starts the transaction before executing the SQL statement.
OH_Rdb_RollBack (OH_Rdb_Store *store)Rolls back the SQL statements executed.
OH_Rdb_Commit (OH_Rdb_Store *store)Commits the executed SQL statements.
OH_Rdb_Backup (OH_Rdb_Store *store, const char *databasePath)Backs up an RDB store in the specified directory.
OH_Rdb_Restore (OH_Rdb_Store *store, const char *databasePath)Restores an RDB store from the specified database backup file.
OH_Rdb_GetVersion (OH_Rdb_Store *store, int *version)Obtains the RDB store version.
OH_Rdb_SetVersion (OH_Rdb_Store *store, int version)Sets the RDB store version.

Variables

NameDescription
OH_Cursor::idUnique identifier of the OH_Cursor struct.
OH_Cursor::getColumnCountPointer to the function used to obtain the number of columns in the result set.
OH_Cursor::getColumnTypePointer to the function used to obtain the column type based on the specified column index.
OH_Cursor::getColumnIndexPointer to the function used to obtain the column index based on the specified column name.
OH_Cursor::getColumnNamePointer to the function used to obtain the column name based on the specified column index.
OH_Cursor::getRowCountPointer to the function used to obtain the number of rows in the result set.
OH_Cursor::goToNextRowPointer to the function used to go to the next row of the result set.
OH_Cursor::getSizePointer to the function used to obtain information about the memory required when the column data type in the result set is BLOB or TEXT.
OH_Cursor::getTextPointer to the function used to obtain the value in the form of a string based on the specified column and the current row.
OH_Cursor::getInt64Pointer to the function used to obtain the value of the int64_t type based on the specified column and the current row.
OH_Cursor::getRealPointer to the function used to obtain the value of the double type based on the specified column and the current row.
OH_Cursor::getBlobPointer to the function used to obtain the value in the form of a byte array based on the specified column and the current row.
OH_Cursor::isNullPointer to the function used to check whether the value in the specified column is null.
OH_Cursor::destroyPointer to the function used to close the result set.
OH_Predicates::idUnique identifier of the OH_Predicates struct.
OH_Predicates::equalToPointer to the function used to set a predicates object to match the field whose value is equal to the specified value.
OH_Predicates::notEqualToPointer to the function used to set a predicates object to match the field whose value is not equal to the specified value.
OH_Predicates::beginWrapPointer to the function used to add a left parenthesis to the predicates.
OH_Predicates::endWrapPointer to the function used to add a right parenthesis to the predicates.
OH_Predicates::orOperatePointer to the function used to add the OR operator to the predicates.
OH_Predicates::andOperatePointer to the function used to add the AND operator to the predicates.
OH_Predicates::isNullPointer to the function used to set a predicates object to match the field whose value is null.
OH_Predicates::isNotNullPointer to the function used to set a predicates object to match the field whose value is not null.
OH_Predicates::likePointer to the function used to set a predicates object to match a string that is similar to the specified value.
OH_Predicates::betweenPointer to the function used to set a predicates object to match the field whose value is within the specified range.
OH_Predicates::notBetweenPointer to the function used to set a predicates object to match the field whose value is out of the specified range.
OH_Predicates::greaterThanPointer to the function used to set a predicates object to match the field with value greater than the specified value.
OH_Predicates::lessThanPointer to the function used to set a predicates object to match the field with value less than the specified value.
OH_Predicates::greaterThanOrEqualToPointer to the function used to set a predicates object to match the field with value greater than or equal to the specified value.
OH_Predicates::lessThanOrEqualToPointer to the function used to set a predicates object to match the field with value less than or equal to the specified value.
OH_Predicates::orderByPointer to the function used to set a predicates object to sort the values in a column in ascending or descending order.
OH_Predicates::distinctPointer to the function used to set a predicates object to filter out duplicate records.
OH_Predicates::limitPointer to the function used to set a predicates object to specify the maximum number of records.
OH_Predicates::offsetPointer to the function used to set a predicates object to specify the start position of the returned result.
OH_Predicates::groupByPointer to the function used to set a predicates object to group rows that have the same value into summary rows.
OH_Predicates::inPointer to the function used to set a predicates object to match the field with the value within the specified range.
OH_Predicates::notInPointer to the function used to set a predicates object to match the field with the value out of the specified range.
OH_Predicates::clearPointer to the function used to clear a predicates instance.
OH_Predicates::destroyPointer to the function used to destroy an OH_Predicates object and reclaim the memory occupied.
OH_VObject::idUnique identifier of the OH_VObject struct.
OH_VObject::putInt64Pointer to the function used to convert a single parameter or an array of the int64 type into a value of the OH_VObject type.
OH_VObject::putDoublePointer to the function used to convert a single parameter or an array of the double type into a value of the OH_VObject type.
OH_VObject::putTextPointer to the function used to convert a character array of the char type to a value of the OH_VObject type.
OH_VObject::putTextsPointer to the function used to convert a string array of the char type to a value of the OH_VObject type.
OH_VObject::destroyPointer to the function used to destroy an OH_VObject object and reclaim the memory occupied.
OH_VBucket::idUnique identifier of the OH_VBucket struct.
OH_VBucket::capabilityNumber of the KV pairs in the struct.
OH_VBucket::putTextPointer to the function used to put a char value into the OH_VBucket object in the given column.
OH_VBucket::putInt64Pointer to the function used to put an int64_t value into the OH_VBucket object in the given column.
OH_VBucket::putRealPointer to the function used to put a double value into the OH_VBucket object in the given column.
OH_VBucket::putBlobPointer to the function used to put a const uint8_t value into the OH_VBucket object in the given column.
OH_VBucket::putNullPointer to the function used to put a null value into the OH_VBucket object in the given column.
OH_VBucket::clearPointer to the function used to clear an OH_VBucket object.
OH_VBucket::destroyPointer to the function used to destroy an OH_VBucket object and reclaim the memory occupied.
OH_Rdb_Config::selfSizeSize of the struct.
OH_Rdb_Config::dataBaseDirPath of the database file.
OH_Rdb_Config::storeNameName of the RDB store.
OH_Rdb_Config::bundleNameBundle name.
OH_Rdb_Config::moduleNameModule name.
OH_Rdb_Config::isEncryptWhether to encrypt the RDB store.
OH_Rdb_Config::securityLevelPointer to the function used to set the RDB store security level OH_Rdb_SecurityLevel.
OH_Rdb_Store::idUnique identifier of the OH_Rdb_Store struct.

Type Description

OH_ColumnType

typedef enum OH_ColumnType OH_ColumnType

Description

Enumerates the field types in an RDB store.

OH_Cursor

typedef struct OH_Cursor OH_Cursor

Description

Indicates a result set.

It provides APIs to access the result set obtained by querying the RDB store.

OH_OrderType

typedef enum OH_OrderType OH_OrderType

Description

Enumerates the sorting types.

OH_Predicates

typedef struct OH_Predicates OH_Predicates

Description

Indicates a predicates object.

OH_Rdb_ErrCode

typedef enum OH_Rdb_ErrCode OH_Rdb_ErrCode

Description

Indicates an error code.

OH_Rdb_SecurityLevel

typedef enum OH_Rdb_SecurityLevel OH_Rdb_SecurityLevel

Description

Enumerates the RDB store security levels.

OH_VBucket

typedef struct OH_VBucket OH_VBucket

Description

Indicates the types of the key and value in a KV pair.

OH_VObject

typedef struct OH_VObject OH_VObject

Description

Indicates the allowed data field types.

Enum Description

OH_ColumnType

enum OH_ColumnType

Description

Enumerates the field types in an RDB store.

ValueDescription
TYPE_NULLNULL type.
TYPE_INT64INT64 type.
TYPE_REALREAL type.
TYPE_TEXTTEXT type.
TYPE_BLOBBLOB type.

OH_OrderType

enum OH_OrderType

Description

Enumerates the sorting types.

ValueDescription
ASCAscending order.
DESCDescending order.

OH_Rdb_ErrCode

enum OH_Rdb_ErrCode

Description

Enumerates the error codes.

ValueDescription
RDB_ERRExecution failed.
RDB_OKExecution successful.
E_BASEBase of the error code.
RDB_E_NOT_SUPPORTEDThe RDB store does not have this capability.
RDB_E_ERRORCommon exception.
RDB_E_INVALID_ARGSInvalid parameter.
RDB_E_CANNOT_UPDATE_READONLYFailed to update data because the RDB store is read-only.
RDB_E_REMOVE_FILEFailed to delete the file.
RDB_E_EMPTY_TABLE_NAMEThe table name is empty.
RDB_E_EMPTY_VALUES_BUCKETThe content of the KV pair is empty.
RDB_E_EXECUTE_IN_STEP_QUERYThe SQL statement executed during the query is incorrect.
RDB_E_INVALID_COLUMN_INDEXThe column index is invalid.
RDB_E_INVALID_COLUMN_TYPEThe column type is invalid.
RDB_E_EMPTY_FILE_NAMEThe file name is empty.
RDB_E_INVALID_FILE_PATHThe file path is invalid.
RDB_E_TRANSACTION_IN_EXECUTEFailed to start the transaction.
RDB_E_INVALID_STATEMENTFailed to precompile the SQL statement.
RDB_E_EXECUTE_WRITE_IN_READ_CONNECTIONFailed to perform a write operation in a read connection.
RDB_E_BEGIN_TRANSACTION_IN_READ_CONNECTIONFailed to start the transaction in a read connection.
RDB_E_NO_TRANSACTION_IN_SESSIONThe transaction to start does not exist in the database session.
RDB_E_MORE_STEP_QUERY_IN_ONE_SESSIONMultiple queries are executed in a database session.
RDB_E_NO_ROW_IN_QUERYThe result set does not contain any record.
RDB_E_INVALID_BIND_ARGS_COUNTThe number of parameters bound in the SQL statement is invalid.
RDB_E_INVALID_OBJECT_TYPEThe object type is invalid.
RDB_E_INVALID_CONFLICT_FLAGThe conflict resolution type is invalid.
RDB_E_HAVING_CLAUSE_NOT_IN_GROUP_BYThe HAVING keyword can be used only after GROUP BY.
RDB_E_NOT_SUPPORTED_BY_STEP_RESULT_SETThe result set by step is not supported.
RDB_E_STEP_RESULT_SET_CROSS_THREADSFailed to obtain the result set.
RDB_E_STEP_RESULT_QUERY_NOT_EXECUTEDThe result set query statement is not executed.
RDB_E_STEP_RESULT_IS_AFTER_LASTThe cursor of the result set is already in the last row.
RDB_E_STEP_RESULT_QUERY_EXCEEDEDThe number of result set query times exceeds the limit.
RDB_E_STATEMENT_NOT_PREPAREDThe SQL statement is not precompiled.
RDB_E_EXECUTE_RESULT_INCORRECTThe database execution result is incorrect.
RDB_E_STEP_RESULT_CLOSEDThe result set has been closed.
RDB_E_RELATIVE_PATHThe file path is a relative path.
RDB_E_EMPTY_NEW_ENCRYPT_KEYThe new encrypt key is empty.
RDB_E_CHANGE_UNENCRYPTED_TO_ENCRYPTEDThe RDB store is non-encrypted and cannot be changed.
RDB_E_CHANGE_ENCRYPT_KEY_IN_BUSYThe database does not respond when the database key is updated.
RDB_E_STEP_STATEMENT_NOT_INITThe precompiled SQL statement is not initialized.
RDB_E_NOT_SUPPORTED_ATTACH_IN_WAL_MODEThe WAL mode does not support the ATTACH operation.
RDB_E_CREATE_FOLDER_FAILFailed to create the folder.
RDB_E_SQLITE_SQL_BUILDER_NORMALIZE_FAILFailed to build the SQL statement.
RDB_E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILYThe database session does not provide a connection.
RDB_E_STORE_SESSION_NO_CURRENT_TRANSACTIONThe transaction does not exist in the database session.
RDB_E_NOT_SUPPORTThe current operation is not supported.
RDB_E_INVALID_PARCELThe current PARCEL is invalid.
RDB_E_QUERY_IN_EXECUTEFailed to execute query.
RDB_E_SET_PERSIST_WALFailed to set the persistence of the database file in WAL mode.
RDB_E_DB_NOT_EXISTThe database does not exist.
RDB_E_ARGS_READ_CON_OVERLOADThe number of read connections to set is greater than the limit.
RDB_E_WAL_SIZE_OVER_LIMITThe WAL log file size exceeds the default value.
RDB_E_CON_OVER_LIMITThe number of database connections has reached the limit.

OH_Rdb_SecurityLevel

enum OH_Rdb_SecurityLevel

Description

Enumerates the RDB store security levels.

ValueDescription
S1The security level of the RDB store is low.
If data leakage occurs, minor impact will be caused.
S2The security level of the RDB store is medium.
If data leakage occurs, moderate impact will be caused.
S3The security level of the RDB store is high.
If data leakage occurs, major impact will be caused.
S4The security level of the RDB store is critical.
If data leakage occurs, critical impact will be caused.

Function Description

OH_Rdb_Backup()

int OH_Rdb_Backup (OH_Rdb_Store * store, const char * databasePath )

Description

Backs up an RDB store in the specified directory.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
databasePathPointer to the destination directory in which the RDB store is backed up.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store.

OH_Rdb_BeginTransaction()

int OH_Rdb_BeginTransaction (OH_Rdb_Store * store)

Description

Starts the transaction before executing the SQL statement.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store.

OH_Rdb_CloseStore()

int OH_Rdb_CloseStore (OH_Rdb_Store * store)

Description

Destroys an OH_Rdb_Store object and reclaims the memory occupied.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store.

OH_Rdb_Commit()

int OH_Rdb_Commit (OH_Rdb_Store * store)

Description

Commits the executed SQL statements.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store.

OH_Rdb_CreatePredicates()

OH_Predicates* OH_Rdb_CreatePredicates (const char * table)

Description

Creates an OH_Predicates instance.

Parameters

NameDescription
tablePointer to the name of the database table.

Returns

Returns the pointer to the OH_Predicates instance created if the operation is successful; returns null otherwise.

See

OH_Predicates.

OH_Rdb_CreateValueObject()

OH_VObject* OH_Rdb_CreateValueObject (void)

Description

Creates an OH_VObject instance.

Returns

Returns the pointer to the OH_VObject instance created if the operation is successful; returns null otherwise.

See

OH_VObject.

OH_Rdb_CreateValuesBucket()

OH_VBucket* OH_Rdb_CreateValuesBucket (void)

Description

Creates an OH_VBucket instance.

Returns

Returns the pointer to the OH_VBucket instance created if the operation is successful; returns null otherwise.

See

OH_VBucket.

OH_Rdb_Delete()

int OH_Rdb_Delete (OH_Rdb_Store * store, OH_Predicates * predicates )

Description

Deletes data from an RDB store based on specified conditions.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
predicatesPointer to the OH_Predicates instance, which specifies the deletion conditions.

Returns

Returns the number of affected rows if the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store, OH_Predicates.

OH_Rdb_DeleteStore()

int OH_Rdb_DeleteStore (const OH_Rdb_Config * config)

Description

Deletes an RDB store with the specified database file configuration.

Parameters

NameDescription
pathPointer to the database path.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

OH_Rdb_Execute()

int OH_Rdb_Execute (OH_Rdb_Store * store, const char * sql )

Description

Executes an SQL statement but returns no value.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
sqlPointer to the SQL statement to execute.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store.

OH_Rdb_ExecuteQuery()

OH_Cursor* OH_Rdb_ExecuteQuery (OH_Rdb_Store * store, const char * sql )

Description

Executes the SQL statement to query data in an RDB store.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
sqlPointer to the SQL statement to execute.

Returns

Returns the pointer to the OH_Cursor instance if the operation is successful; returns null otherwise.

See

OH_Rdb_Store.

OH_Rdb_GetOrOpen()

OH_Rdb_Store* OH_Rdb_GetOrOpen (const OH_Rdb_Config * config, int * errCode )

Description

Obtains an OH_Rdb_Store instance for RDB store operations.

Parameters

NameDescription
configPointer to the OH_Rdb_Config instance, which specifies the database configuration.
errCodeFunction execution status.

Returns

Returns the pointer to the OH_Rdb_Store instance created if the operation is successful; returns null otherwise.

See

OH_Rdb_Config, OH_Rdb_Store.

OH_Rdb_GetVersion()

int OH_Rdb_GetVersion (OH_Rdb_Store * store, int * version )

Description

Obtains the RDB store version.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
versionPointer to the version number.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store.

OH_Rdb_Insert()

int OH_Rdb_Insert (OH_Rdb_Store * store, const char * table, OH_VBucket * valuesBucket )

Description

Inserts a row of data into a table.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
tablePointer to the target table.
valuesBucketPointer to the data OH_VBucket to insert.

Returns

Returns the row ID if the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store, OH_VBucket.

OH_Rdb_Query()

OH_Cursor* OH_Rdb_Query (OH_Rdb_Store * store, OH_Predicates * predicates, const char *const * columnNames, int length )

Description

Queries data in an RDB store based on specified conditions.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
predicatesPointer to the OH_Predicates instance, which specifies the query conditions.
columnNamesPointer to the columns to query. If this parameter is not specified, data of columns will be queried.
lengthLength of the columnNames array. If length is greater than the length of columnNames array, out-of-bounds access occurs.

Returns

Returns the pointer to the OH_Cursor instance if the operation is successful; returns null otherwise.

See

OH_Rdb_Store, OH_Predicates, OH_Cursor.

OH_Rdb_Restore()

int OH_Rdb_Restore (OH_Rdb_Store * store, const char * databasePath )

Description

Restores an RDB store from the specified database backup file.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
databasePathPointer to the destination directory in which the RDB store is backed up.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store.

OH_Rdb_RollBack()

int OH_Rdb_RollBack (OH_Rdb_Store * store)

Description

Rolls back the SQL statements executed.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store.

OH_Rdb_SetVersion()

int OH_Rdb_SetVersion (OH_Rdb_Store * store, int version )

Description

Sets the RDB store version.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
versionPointer to the version number.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store.

OH_Rdb_Update()

int OH_Rdb_Update (OH_Rdb_Store * store, OH_VBucket * valuesBucket, OH_Predicates * predicates )

Description

Updates data in an RDB store based on specified conditions.

Parameters

NameDescription
storePointer to the OH_Rdb_Store instance.
valuesBucketPointer to the new data OH_VBucket to be updated to the table.
predicatesPointer to the OH_Predicates instance, specifying the update conditions.

Returns

Returns the number of affected rows if the operation is successful; returns an error code otherwise.

See

OH_Rdb_Store, OH_Bucket, OH_Predicates.

Variable Description

andOperate

OH_Predicates*(* OH_Predicates::andOperate) (OH_Predicates *predicates)

Description

Pointer to the function used to add the AND operator to the predicates.

This method is equivalent to AND in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.

Returns

Returns the predicates with the AND operator.

See

OH_Predicates.

beginWrap

OH_Predicates*(* OH_Predicates::beginWrap) (OH_Predicates *predicates)

Description

Pointer to the function used to add a left parenthesis to the predicates.

This method is equivalent to "(" in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.

Returns

Returns the predicates with a left parenthesis.

See

OH_Predicates.

between

OH_Predicates*(* OH_Predicates::between) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field whose value is within the specified range.

This method is equivalent to BETWEEN in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the start and end values.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

storeName

const char* OH_Rdb_Config::storeName

Description

Name of the RDB store.

bundleName

const char* OH_Rdb_Config::bundleName

Description

Application bundle name.

capability

uint16_t OH_VBucket::capability

Description

Number of the KV pairs in the struct.

clear [1/2]

OH_Predicates*(* OH_Predicates::clear) (OH_Predicates *predicates)

Description

Pointer to the function used to clear a predicates instance.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.

Returns

Returns the cleared predicates.

See

OH_Predicates.

clear [2/2]

int(* OH_VBucket::clear) (OH_VBucket *bucket)

Description

Clears an OH_VBucket object.

Parameters

NameDescription
bucketPointer to the OH_VBucket instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VBucket.

dataBaseDir

const char* OH_Rdb_Config::dataBaseDir

Description

Path of the database file.

destroy [1/4]

int(* OH_Cursor::destroy) (OH_Cursor *cursor)

Description

Pointer to the function used to close the result set.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

destroy [2/4]

int(* OH_Predicates::destroy) (OH_Predicates *predicates)

Description

Destroys an OH_Predicates object and reclaims the memory occupied.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Predicates.

destroy [3/4]

int(* OH_VBucket::destroy) (OH_VBucket *bucket)

Description

Destroys an OH_VBucket object and reclaims the memory occupied.

Parameters

NameDescription
bucketPointer to the OH_VBucket instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VBucket.

destroy [4/4]

int(* OH_VObject::destroy) (OH_VObject *valueObject)

Description

Destroys an OH_VObject object and reclaims the memory occupied.

Parameters

NameDescription
valueObjectPointer to the OH_VObject instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VObject.

distinct

OH_Predicates*(* OH_Predicates::distinct) (OH_Predicates *predicates)

Description

Pointer to the function used to set a predicates object to filter out duplicate records.

This method is equivalent to DISTINCT in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.

Returns

Returns the predicates created.

See

OH_Predicates.

endWrap

OH_Predicates*(* OH_Predicates::endWrap) (OH_Predicates *predicates)

Description

Pointer to the function used to add a right parenthesis to the predicates.

This method is equivalent to ")" in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.

Returns

Returns the predicates object with a right parenthesis.

See

OH_Predicates.

equalTo

OH_Predicates*(* OH_Predicates::equalTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field whose value is equal to the specified value.

This method is equivalent to "=" in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value to match.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

getBlob

int(* OH_Cursor::getBlob) (OH_Cursor *cursor, int32_t columnIndex, unsigned char *value, int length)

Description

Pointer to the function used to obtain the value in the form of a byte array based on the specified column and the current row.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
columnIndexColumn index.
valuePointer to the value in the form of a byte array obtained.
lengthLength of the value, which can be obtained by getSize().

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

getColumnCount

int(* OH_Cursor::getColumnCount) (OH_Cursor *cursor, int *count)

Description

Pointer to the function used to obtain the number of columns in the result set.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
countPointer to the number of columns in the result set obtained.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

getColumnIndex

int(* OH_Cursor::getColumnIndex) (OH_Cursor *cursor, const char *name, int *columnIndex)

Description

Pointer to the function used to obtain the column index based on the specified column name.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
namePointer to the column name in the result set.
columnIndexPointer to the column index obtained.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

getColumnName

int(* OH_Cursor::getColumnName) (OH_Cursor *cursor, int32_t columnIndex, char *name, int length)

Description

Pointer to the function used to obtain the column name based on the specified column index.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
columnIndexColumn index.
namePointer to the column name obtained.
lengthLength of a column name.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

getColumnType

int(* OH_Cursor::getColumnType) (OH_Cursor *cursor, int32_t columnIndex, OH_ColumnType *columnType)

Description

Pointer to the function used to obtain the column type based on the specified column index.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
columnIndexColumn index.
columnTypePointer to the OH_ColumnType obtained.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor, OH_ColumnType.

getInt64

int(* OH_Cursor::getInt64) (OH_Cursor *cursor, int32_t columnIndex, int64_t *value)

Description

Pointer to the function used to obtain the value of the int64_t type based on the specified column and the current row.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
columnIndexColumn index.
valuePointer to the value obtained.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

getReal

int(* OH_Cursor::getReal) (OH_Cursor *cursor, int32_t columnIndex, double *value)

Description

Pointer to the function used to obtain the value of the double type based on the specified column and the current row.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
columnIndexColumn index.
valuePointer to the value obtained.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

getRowCount

int(* OH_Cursor::getRowCount) (OH_Cursor *cursor, int *count)

Description

Pointer to the function used to obtain the number of rows in the result set.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
countPointer to the number of columns in the result set obtained.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

getSize

int(* OH_Cursor::getSize) (OH_Cursor *cursor, int32_t columnIndex, size_t *size)

Description

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.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
columnIndexColumn index.
sizePointer to the memory size obtained.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

getText

int(* OH_Cursor::getText) (OH_Cursor *cursor, int32_t columnIndex, char *value, int length)

Description

Pointer to the function used to obtain the value in the form of a string based on the specified column and the current row.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
columnIndexColumn index.
valuePointer to the value in the form of a string obtained.
lengthLength of the value, which can be obtained by getSize().

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

goToNextRow

int(* OH_Cursor::goToNextRow) (OH_Cursor *cursor)

Description

Pointer to the function used to go to the next row of the result set.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

greaterThan

OH_Predicates*(* OH_Predicates::greaterThan) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field with value greater than the specified value.

This method is equivalent to ">" in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value to match.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

greaterThanOrEqualTo

OH_Predicates*(* OH_Predicates::greaterThanOrEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field with value greater than or equal to the specified value.

This method is equivalent to ">=" in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value to match.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

groupBy

OH_Predicates*(* OH_Predicates::groupBy) (OH_Predicates *predicates, char const *const *fields, int length)

Description

Pointer to the function used to set a predicates object to group rows that have the same value into summary rows.

This method is equivalent to GROUP BY in the SQL statement.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldsPointer to the names of the columns by which the records are grouped.
lengthLength of the fields value.

Returns

Returns the predicates created.

See

OH_Predicates.

id [1/4]

int64_t OH_Predicates::id

Description

Unique identifier of the OH_Predicates struct.

id [2/4]

int64_t OH_VObject::id

Description

Unique identifier of the OH_VObject struct.

id [3/4]

int64_t OH_VBucket::id

Description

Unique identifier of the OH_VBucket struct.

id [4/4]

int64_t OH_Rdb_Store::id

Description

Unique identifier of the OH_Rdb_Store struct.

in

OH_Predicates*(* OH_Predicates::in) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field with the value within the specified range.

This method is equivalent to IN in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value range.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

isEncrypt

bool OH_Rdb_Config::isEncrypt

Description

Whether to encrypt the RDB store.

isNotNull

OH_Predicates*(* OH_Predicates::isNotNull) (OH_Predicates *predicates, const char *field)

Description

Pointer to the function used to set a predicates object to match the field whose value is not null.

This method is equivalent to IS NOT NULL in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.

Returns

Returns the predicates created.

See

OH_Predicates.

isNull [1/2]

int(* OH_Cursor::isNull) (OH_Cursor *cursor, int32_t columnIndex, bool *isNull)

Description

Pointer to the function used to check whether the value in the specified column is null.

Parameters

NameDescription
cursorPointer to the OH_Cursor instance.
columnIndexColumn index.
isNullPointer to the value returned. The value true means the value is null; the value false means the opposite.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_Cursor.

isNull [2/2]

OH_Predicates*(* OH_Predicates::isNull) (OH_Predicates *predicates, const char *field)

Description

Pointer to the function used to set a predicates object to match the field whose value is null.

This method is equivalent to IS NULL in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.

Returns

Returns the predicates created.

See

OH_Predicates.

lessThan

OH_Predicates*(* OH_Predicates::lessThan) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field with value less than the specified value.

This method is equivalent to "<" in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value to match.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

lessThanOrEqualTo

OH_Predicates*(* OH_Predicates::lessThanOrEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field with value less than or equal to the specified value.

This method is equivalent to "<=" in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value to match.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

like

OH_Predicates*(* OH_Predicates::like) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match a string that is similar to the specified value.

This method is equivalent to LIKE in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value to match.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

limit

OH_Predicates*(* OH_Predicates::limit) (OH_Predicates *predicates, unsigned int value)

Description

Pointer to the function used to set a predicates object to specify the maximum number of records.

This method is equivalent to LIMIT in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
valueMaximum number of data records.

Returns

Returns the predicates created.

See

OH_Predicates.

moduleName

const char* OH_Rdb_Config::moduleName

Description

Module name.

notBetween

OH_Predicates*(* OH_Predicates::notBetween) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field whose value is out of the specified range.

This method is equivalent to NOT BETWEEN in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value to match.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

notEqualTo

OH_Predicates*(* OH_Predicates::notEqualTo) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field whose value is not equal to the specified value.

This method is equivalent to "!=" in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value to match.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

notIn

OH_Predicates*(* OH_Predicates::notIn) (OH_Predicates *predicates, const char *field, OH_VObject *valueObject)

Description

Pointer to the function used to set a predicates object to match the field with the value out of the specified range.

This method is equivalent to NOT IN in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
valueObjectPointer to the OH_VObject instance, which specifies the value range to match.

Returns

Returns the predicates created.

See

OH_Predicates, OH_VObject.

offset

OH_Predicates*(* OH_Predicates::offset) (OH_Predicates *predicates, unsigned int rowOffset)

Description

Pointer to the function used to set a predicates object to specify the start position of the returned result.

This method is equivalent to OFFSET in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
rowOffsetStart position of the returned result. The value is a positive integer.

Returns

Returns the predicates created.

See

OH_Predicates.

orderBy

OH_Predicates*(* OH_Predicates::orderBy) (OH_Predicates *predicates, const char *field, OH_OrderType type)

Description

Pointer to the function used to set a predicates object to sort the values in a column in ascending or descending order.

This method is equivalent to ORDER BY in the SQL statement.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.
fieldPointer to the column name in the database table.
typeSorting type OH_OrderType.

Returns

Returns the predicates created.

See

OH_Predicates, OH_OrderType.

orOperate

OH_Predicates*(* OH_Predicates::orOperate) (OH_Predicates *predicates)

Description

Pointer to the function used to add the OR operator to the predicates.

This method is equivalent to OR in SQL statements.

Parameters

NameDescription
predicatesPointer to the OH_Predicates instance.

Returns

Returns the predicates with the OR operator.

See

OH_Predicates.

putBlob

int(* OH_VBucket::putBlob) (OH_VBucket *bucket, const char *field, const uint8_t *value, uint32_t size)

Description

Puts a const uint8_t value into the OH_VBucket object in the given column.

Parameters

NameDescription
bucketPointer to the OH_VBucket instance.
fieldPointer to the column name in the database table.
valuePointer to the value to put.
sizeLength of the value.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VBucket.

putDouble

int(* OH_VObject::putDouble) (OH_VObject *valueObject, double *value, uint32_t count)

Description

Converts a single parameter or an array of the double type into a value of the OH_VObject type.

Parameters

NameDescription
valueObjectPointer to the OH_VObject instance.
valuePointer to the data to covert.
countIf value points to a single parameter, count is 1. If value points to an array, count specifies the length of the array.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VObject.

putInt64 [1/2]

int(* OH_VBucket::putInt64) (OH_VBucket *bucket, const char *field, int64_t value)

Description

Puts an int64_t value into the OH_VBucket object in the given column.

Parameters

NameDescription
bucketPointer to the OH_VBucket instance.
fieldPointer to the column name in the database table.
valueValue to put.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VBucket.

putInt64 [2/2]

int(* OH_VObject::putInt64) (OH_VObject *valueObject, int64_t *value, uint32_t count)

Description

Converts a single parameter or an array of the int64 type into a value of the OH_VObject type.

Parameters

NameDescription
valueObjectPointer to the OH_VObject instance.
valuePointer to the data to covert.
countIf value points to a single parameter, count is 1. If value points to an array, count specifies the length of the array.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VObject.

putNull

int(* OH_VBucket::putNull) (OH_VBucket *bucket, const char *field)

Description

Puts a null value into the OH_VBucket object in the given column.

Parameters

NameDescription
bucketPointer to the OH_VBucket instance.
fieldPointer to the column name in the database table.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VBucket.

putReal

int(* OH_VBucket::putReal) (OH_VBucket *bucket, const char *field, double value)

Description

Puts a double value into the OH_VBucket object in the given column.

Parameters

NameDescription
bucketPointer to the OH_VBucket instance.
fieldPointer to the column name in the database table.
valueValue to put.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VBucket.

putText [1/2]

int(* OH_VBucket::putText) (OH_VBucket *bucket, const char *field, const char *value)

Description

Puts a char value into the OH_VBucket object in the given column.

Parameters

NameDescription
bucketPointer to the OH_VBucket instance.
fieldPointer to the column name in the database table.
valuePointer to the value to put.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VBucket.

putText [2/2]

int(* OH_VObject::putText) (OH_VObject *valueObject, const char *value)

Description

Converts a character array of the char type to a value of the OH_VObject type.

Parameters

NameDescription
valueObjectPointer to the OH_VObject instance.
valuePointer to the character array to convert.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VObject.

putTexts

int(* OH_VObject::putTexts) (OH_VObject *valueObject, const char **value, uint32_t count)

Description

Converts a string array of the char type to a value of the OH_VObject type.

Parameters

NameDescription
valueObjectPointer to the OH_VObject instance.
valuePointer to the string array to convert.
countLength of the string array to convert.

Returns

Returns RDB_OK is the operation is successful; returns an error code otherwise.

See

OH_VObject.

securityLevel

int OH_Rdb_Config::securityLevel

Description

Set the RDB store security level OH_Rdb_SecurityLevel.

selfSize

int OH_Rdb_Config::selfSize

Description

Size of the struct.

你可能感兴趣的鸿蒙文章

harmony 鸿蒙Native APIs

harmony 鸿蒙AVCapability

harmony 鸿蒙AVDemuxer

harmony 鸿蒙AVMuxer

harmony 鸿蒙AVScreenCapture

harmony 鸿蒙AVSource

harmony 鸿蒙AudioDecoder

harmony 鸿蒙AudioEncoder

harmony 鸿蒙CodecBase

harmony 鸿蒙Core

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/da1e6894ac9c4094b3c82544bfe2ada4