From e11e6293d9a4670e6640d709aad7be006c1e609f Mon Sep 17 00:00:00 2001 From: ZhaoJinghui Date: Mon, 24 Mar 2025 19:47:40 +0800 Subject: [PATCH 1/2] Revert "add batchinsert" This reverts commit d5baa40b717d3cd5f6344f5588c304388ecec759. Change-Id: I0829d4b7560132b3a058a08fd72f459cf4a58821 Signed-off-by: ZhaoJinghui --- distributeddatamgr/relational_store/BUILD.gn | 4 +- .../include/oh_rdb_transaction.h | 5 +- .../relational_store/include/oh_rdb_types.h | 83 ------------------- .../include/relational_store.h | 31 ------- .../include/relational_store_error_code.h | 7 -- .../relational_store/libnative_rdb.ndk.json | 4 - 6 files changed, 2 insertions(+), 132 deletions(-) delete mode 100644 distributeddatamgr/relational_store/include/oh_rdb_types.h diff --git a/distributeddatamgr/relational_store/BUILD.gn b/distributeddatamgr/relational_store/BUILD.gn index 560c94d4d..203e78f46 100644 --- a/distributeddatamgr/relational_store/BUILD.gn +++ b/distributeddatamgr/relational_store/BUILD.gn @@ -21,7 +21,6 @@ ohos_ndk_headers("native_rdb_ndk_header") { "./include/oh_cursor.h", "./include/oh_predicates.h", "./include/oh_rdb_transaction.h", - "./include/oh_rdb_types.h", "./include/oh_value_object.h", "./include/oh_values_bucket.h", "./include/relational_store.h", @@ -53,10 +52,9 @@ ohos_ndk_library("libnative_rdb_ndk") { "$ndk_headers_out_dir/database/rdb/oh_cursor.h", "$ndk_headers_out_dir/database/rdb/oh_predicates.h", "$ndk_headers_out_dir/database/rdb/oh_rdb_transaction.h", - "$ndk_headers_out_dir/database/rdb/oh_rdb_types.h", "$ndk_headers_out_dir/database/rdb/oh_value_object.h", "$ndk_headers_out_dir/database/rdb/oh_values_bucket.h", "$ndk_headers_out_dir/database/rdb/relational_store.h", "$ndk_headers_out_dir/database/rdb/relational_store_error_code.h", ] -} +} \ No newline at end of file diff --git a/distributeddatamgr/relational_store/include/oh_rdb_transaction.h b/distributeddatamgr/relational_store/include/oh_rdb_transaction.h index aa34f0228..3331a5e50 100644 --- a/distributeddatamgr/relational_store/include/oh_rdb_transaction.h +++ b/distributeddatamgr/relational_store/include/oh_rdb_transaction.h @@ -43,7 +43,6 @@ #include "database/rdb/oh_cursor.h" #include "database/rdb/oh_predicates.h" #include "database/rdb/oh_values_bucket.h" -#include "database/rdb/oh_rdb_types.h" #include "database/data/oh_data_values.h" #include "database/data/oh_data_values_buckets.h" @@ -199,7 +198,6 @@ int OH_RdbTrans_Insert(OH_Rdb_Transaction *trans, const char *table, const OH_VB * @param trans Represents a pointer to an instance of OH_Rdb_Transaction. * @param table Represents the target table. * @param rows Represents the rows data to be inserted into the table. - * @param resolution Represents the resolution when conflict occurs. * @param changes Represents the number of successful insertions. * @return Returns the status code of the execution. * Returns {@link RDB_OK} if the execution is successful. @@ -217,11 +215,10 @@ int OH_RdbTrans_Insert(OH_Rdb_Transaction *trans, const char *table, const OH_VB * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. - * Returns {@link RDB_E_SQLITE_CONSTRAINT} SQLite: Abort due to constraint violation. * @since 18 */ int OH_RdbTrans_BatchInsert(OH_Rdb_Transaction *trans, const char *table, const OH_Data_VBuckets *rows, - Rdb_ConflictResolution resolution, int64_t *changes); + int64_t *changes); /** * @brief Updates data in the database based on specified conditions. diff --git a/distributeddatamgr/relational_store/include/oh_rdb_types.h b/distributeddatamgr/relational_store/include/oh_rdb_types.h deleted file mode 100644 index cf0f76bf0..000000000 --- a/distributeddatamgr/relational_store/include/oh_rdb_types.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2025 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @addtogroup RDB - * @{ - * - * @brief The relational database (RDB) store manages data based on relational models. - * With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases. - * To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations - * such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. - * - * @since 10 - */ - -/** - * @file oh_rdb_types.h - * - * @brief Provides type define related to the data value. - * - * @kit ArkData - * @library libnative_rdb_ndk.z.so - * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core - * - * @since 18 - */ - -#ifndef OH_RDB_TYPES_H -#define OH_RDB_TYPES_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief Describe the security area of the database. - * - * @since 18 - */ -typedef enum Rdb_ConflictResolution { - /** - * @brief Implements no operation when conflict occurs. - */ - RDB_CONFLICT_NONE = 1, - /** - * @brief Implements rollback operation when conflict occurs. - */ - RDB_CONFLICT_ROLLBACK, - /** - * @brief Implements abort operation when conflict occurs. - */ - RDB_CONFLICT_ABORT, - /** - * @brief Implements fail operation when conflict occurs. - */ - RDB_CONFLICT_FAIL, - /** - * @brief Implements ignore operation when conflict occurs. - */ - RDB_CONFLICT_IGNORE, - /** - * @brief Implements replace operation when conflict occurs. - */ - RDB_CONFLICT_REPLACE, -} Rdb_ConflictResolution; - -#ifdef __cplusplus -}; -#endif -#endif -/** @} */ \ No newline at end of file diff --git a/distributeddatamgr/relational_store/include/relational_store.h b/distributeddatamgr/relational_store/include/relational_store.h index 54d2cc405..0619c3282 100644 --- a/distributeddatamgr/relational_store/include/relational_store.h +++ b/distributeddatamgr/relational_store/include/relational_store.h @@ -44,7 +44,6 @@ #include "database/rdb/oh_value_object.h" #include "database/rdb/oh_values_bucket.h" #include "database/rdb/oh_rdb_transaction.h" -#include "database/rdb/oh_rdb_types.h" #ifdef __cplusplus extern "C" { @@ -501,36 +500,6 @@ int OH_Rdb_DeleteStoreV2(const OH_Rdb_ConfigV2 *config); */ int OH_Rdb_Insert(OH_Rdb_Store *store, const char *table, OH_VBucket *valuesBucket); -/** - * @brief Inserts a batch of data into the target table. - * - * @param store Represents a pointer to an {@link OH_Rdb_Store} instance. - * @param table Represents the target table. - * @param rows Represents the rows data to be inserted into the table. - * @param resolution Represents the resolution when conflict occurs. - * @param changes Represents the number of successful insertions. - * @return Returns the status code of the execution. - * Returns {@link RDB_OK} if the execution is successful. - * Returns {@link RDB_E_ERROR} database common error. - * Returns {@link RDB_E_INVALID_ARGS} if invalid input parameter. - * Returns {@link RDB_E_ALREADY_CLOSED} database already closed. - * Returns {@link RDB_E_WAL_SIZE_OVER_LIMIT} the WAL file size over default limit. - * Returns {@link RDB_E_SQLITE_FULL} SQLite: The database is full. - * Returns {@link RDB_E_SQLITE_CORRUPT} database corrupted. - * Returns {@link RDB_E_SQLITE_PERM} SQLite: Access permission denied. - * Returns {@link RDB_E_SQLITE_BUSY} SQLite: The database file is locked. - * Returns {@link RDB_E_SQLITE_LOCKED} SQLite: A table in the database is locked. - * Returns {@link RDB_E_SQLITE_NOMEM} SQLite: The database is out of memory. - * Returns {@link RDB_E_SQLITE_READONLY} SQLite: Attempt to write a readonly database. - * Returns {@link RDB_E_SQLITE_IOERR} SQLite: Some kind of disk I/O error occurred. - * Returns {@link RDB_E_SQLITE_TOO_BIG} SQLite: TEXT or BLOB exceeds size limit. - * Returns {@link RDB_E_SQLITE_MISMATCH} SQLite: Data type mismatch. - * Returns {@link RDB_E_SQLITE_CONSTRAINT} SQLite: Abort due to constraint violation. - * @since 18 - */ -int OH_Rdb_BatchInsert(OH_Rdb_Store *store, const char *table, - const OH_Data_VBuckets *rows, Rdb_ConflictResolution resolution, int64_t *changes); - /** * @brief Updates data in the database based on specified conditions. * diff --git a/distributeddatamgr/relational_store/include/relational_store_error_code.h b/distributeddatamgr/relational_store/include/relational_store_error_code.h index c75b849e0..8030b391c 100644 --- a/distributeddatamgr/relational_store/include/relational_store_error_code.h +++ b/distributeddatamgr/relational_store/include/relational_store_error_code.h @@ -413,13 +413,6 @@ typedef enum OH_Rdb_ErrCode { * @since 18 */ RDB_E_TYPE_MISMATCH = (E_BASE + 64), - - /** - * @brief Data value type is null. - * - * @since 18 - */ - RDB_E_SQLITE_CONSTRAINT = (E_BASE + 65), } OH_Rdb_ErrCode; #ifdef __cplusplus diff --git a/distributeddatamgr/relational_store/libnative_rdb.ndk.json b/distributeddatamgr/relational_store/libnative_rdb.ndk.json index 5d4110e08..c2c40471b 100644 --- a/distributeddatamgr/relational_store/libnative_rdb.ndk.json +++ b/distributeddatamgr/relational_store/libnative_rdb.ndk.json @@ -74,10 +74,6 @@ { "name":"OH_Rdb_Insert" }, - { - "first_introduced": "18", - "name":"OH_Rdb_BatchInsert" - }, { "name":"OH_Rdb_Update" }, -- Gitee From f20ec44e1b0002ec59ca3cee842d6029a29b4bd0 Mon Sep 17 00:00:00 2001 From: ZhaoJinghui Date: Mon, 24 Mar 2025 19:52:43 +0800 Subject: [PATCH 2/2] Revert "add memory db" This reverts commit 176bff448c9d620a9d7ac802c74c814ba279d69f. Signed-off-by: ZhaoJinghui Change-Id: I55bbf3d530e94169361ebaee6a4fe5e9219ca2c4 --- .../relational_store/include/relational_store.h | 13 ------------- .../relational_store/libnative_rdb.ndk.json | 4 ---- 2 files changed, 17 deletions(-) diff --git a/distributeddatamgr/relational_store/include/relational_store.h b/distributeddatamgr/relational_store/include/relational_store.h index 0619c3282..79347bda9 100644 --- a/distributeddatamgr/relational_store/include/relational_store.h +++ b/distributeddatamgr/relational_store/include/relational_store.h @@ -344,19 +344,6 @@ int OH_Rdb_SetDbType(OH_Rdb_ConfigV2 *config, int dbType); */ int OH_Rdb_SetTokenizer(OH_Rdb_ConfigV2 *config, Rdb_Tokenizer tokenizer); -/** - * @brief Set property persist into config - * - * @param config Represents a pointer to {@link OH_Rdb_ConfigV2} instance. - * Indicates the configuration of the database related to this RDB store. - * @param isPersistent Indicates whether the database need persistence. - * @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. - * @since 18 - */ -int OH_Rdb_SetPersistent(OH_Rdb_ConfigV2 *config, bool isPersistent); - /** * @brief Check if a tokenizer is supported or not. * diff --git a/distributeddatamgr/relational_store/libnative_rdb.ndk.json b/distributeddatamgr/relational_store/libnative_rdb.ndk.json index c2c40471b..e481f38cf 100644 --- a/distributeddatamgr/relational_store/libnative_rdb.ndk.json +++ b/distributeddatamgr/relational_store/libnative_rdb.ndk.json @@ -44,10 +44,6 @@ "first_introduced": "14", "name":"OH_Rdb_SetDbType" }, - { - "first_introduced": "18", - "name":"OH_Rdb_SetPersistent" - }, { "first_introduced": "14", "name":"OH_Rdb_GetSupportedDbType" -- Gitee