From ecf30407b4c31cbb1e739073210937d30a5996a2 Mon Sep 17 00:00:00 2001 From: ZhaoJinghui Date: Thu, 21 Nov 2024 21:41:04 +0800 Subject: [PATCH] relationalStore add repair API Signed-off-by: ZhaoJinghui Change-Id: I15d31d771929c0f88ddcd3855c939e49f55f2ce5 --- .../relational_store/include/relational_store.h | 16 ++++++++++++++++ .../relational_store/libnative_rdb.ndk.json | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/distributeddatamgr/relational_store/include/relational_store.h b/distributeddatamgr/relational_store/include/relational_store.h index b8be9a6aa..359106761 100644 --- a/distributeddatamgr/relational_store/include/relational_store.h +++ b/distributeddatamgr/relational_store/include/relational_store.h @@ -426,6 +426,22 @@ int OH_Rdb_DeleteStore(const OH_Rdb_Config *config); */ int OH_Rdb_DeleteStoreV2(const OH_Rdb_ConfigV2 *config); +/** + * @brief Repair an RDB store with OH_Rdb_ConfigV2. + * + * You can repair the RDB store when database corrupted. + * + * @param config Represents a pointer to an {@link OH_Rdb_ConfigV2} instance. + * Indicates the configuration of the database related to this RDB store. + * @return Returns the status code of the execution. Successful execution returns RDB_OK, + * {@link RDB_OK} - success. + * {@link RDB_E_INVALID_ARGS} - The error code for common invalid args. + * Get database path failed.Get RDB Store fail. Nullptr is returned. + * @see OH_Rdb_ConfigV2, OH_Rdb_Store. + * @since 14 + */ +int OH_Rdb_Repair(const OH_Rdb_ConfigV2 *config); + /** * @brief Inserts a row of data into the target table. * diff --git a/distributeddatamgr/relational_store/libnative_rdb.ndk.json b/distributeddatamgr/relational_store/libnative_rdb.ndk.json index 5e0681865..beaa9ef8a 100644 --- a/distributeddatamgr/relational_store/libnative_rdb.ndk.json +++ b/distributeddatamgr/relational_store/libnative_rdb.ndk.json @@ -57,6 +57,10 @@ "first_introduced": "14", "name":"OH_Rdb_DeleteStoreV2" }, + { + "first_introduced": "14", + "name":"OH_Rdb_Repair" + }, {"name":"OH_Rdb_Insert" }, {"name":"OH_Rdb_Update" }, {"name":"OH_Rdb_Delete" }, -- Gitee