relational_store.h

Overview

Provides APIs to manage a relational database (RDB) store.

File to include: <database/rdb/relational_store.h>

Library: libnative_rdb_ndk.z.so Since

10

Related Modules

RDB

Summary

Structs

Name Description
OH_Rdb_Config Defines the RDB store configuration.
OH_Rdb_Store Defines the RDB store type.

Types

Name Description
OH_Rdb_SecurityLevel Defines an enum for RDB store security levels.

Enums

Name Description
OH_Rdb_SecurityLevel { S1 = 1, S2, S3, S4 } Enumerates the RDB store security levels.

Functions

Name Description
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 the SQL statement that returns no value.
OH_Rdb_ExecuteQuery (OH_Rdb_Store *store, const char *sql) Queries data in an RDB store based on the SQL statements executed.
OH_Rdb_BeginTransaction (OH_Rdb_Store *store) Starts the transaction before executing the SQL statements.
OH_Rdb_RollBack (OH_Rdb_Store *store) Rolls back the SQL statements that have been 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 the RDB store in the specified path.
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.