Signed-off-by: lihuihui <lihuihui29@huawei.com>
This commit is contained in:
lihuihui 2023-06-15 22:37:00 +08:00
parent 2ee2713f02
commit 0beb5f8ebb
12 changed files with 16 additions and 28 deletions

View File

@ -87,7 +87,7 @@
"oh_predicates.h",
"relational_store.h",
"oh_cursor.h",
"relational_error_code.h",
"relational_store_error_code.h",
"oh_value_object.h",
"oh_values_bucket.h"
],

View File

@ -129,7 +129,7 @@ void RdbStoreImpl::GetSchema(const RdbStoreConfig &config)
RdbStoreImpl::RdbStoreImpl(const RdbStoreConfig &config)
: rdbStoreConfig(config), connectionPool(nullptr), isOpen(false), path(""), orgPath(""), isReadOnly(false),
isMemoryRdb(false), isEncrypt_(false)
isMemoryRdb(false), isEncrypt_(false), backupFilePath_({})
{
}
@ -1110,12 +1110,12 @@ int RdbStoreImpl::ConfigLocale(const std::string localeStr)
int RdbStoreImpl::Restore(const std::string backupPath, const std::vector<uint8_t> &newKey)
{
if (isOpen == false) {
LOG_ERROR("ChangeDbFileForRestore:The connection pool has been closed.");
LOG_ERROR("The connection pool has been closed.");
return E_ERROR;
}
if (connectionPool == nullptr) {
LOG_ERROR("ChangeDbFileForRestore:The connectionPool is null.");
LOG_ERROR("The connectionPool is null.");
return E_ERROR;
}
@ -1126,7 +1126,7 @@ int RdbStoreImpl::Restore(const std::string backupPath, const std::vector<uint8_
}
if (backupFilePath == path) {
LOG_ERROR("ChangeDbFileForRestore:The backupPath and path should not be same.");
LOG_ERROR("The backupPath and path should not be same.");
return E_INVALID_FILE_PATH;
}

View File

@ -359,16 +359,6 @@ public:
*/
virtual int Restore(const std::string backupPath, const std::vector<uint8_t> &newKey = std::vector<uint8_t>()) = 0;
/**
* @brief Restores a database from a specified encrypted or unencrypted database file.
*
* @param newPath Indicates the database new path.
* @param backupPath Indicates the database backup path.
* @param newKey Indicates the database new key.
*/
virtual int ChangeDbFileForRestore(const std::string newPath, const std::string backupPath,
const std::vector<uint8_t> &newKey) = 0;
/**
* @brief Set table to be distributed table.
*

View File

@ -83,8 +83,6 @@ public:
virtual bool IsReadOnly() const = 0;
virtual bool IsMemoryRdb() const = 0;
virtual int Restore(const std::string backupPath, const std::vector<uint8_t> &newKey = std::vector<uint8_t>()) = 0;
virtual int ChangeDbFileForRestore(const std::string newPath, const std::string backupPath,
const std::vector<uint8_t> &newKey) = 0;
};
} // namespace OHOS::NativeRdb
#endif

View File

@ -22,7 +22,7 @@ ohos_ndk_headers("native_rdb_ndk_header") {
"./include/oh_predicates.h",
"./include/oh_value_object.h",
"./include/oh_values_bucket.h",
"./include/relational_error_code.h",
"./include/relational_store_error_code.h",
"./include/relational_store.h",
]
}

View File

@ -13,8 +13,8 @@
* limitations under the License.
*/
#ifndef RELATIONAL_ERRNO_CODE_H
#define RELATIONAL_ERRNO_CODE_H
#ifndef RELATIONAL_STORE_ERRNO_CODE_H
#define RELATIONAL_STORE_ERRNO_CODE_H
/**
* @addtogroup RDB
@ -31,7 +31,7 @@
/**
* @file relational_error_code.h
* @file relational_store_error_code.h
*
* @brief Declaration error code information.
*
@ -313,4 +313,4 @@ typedef enum OH_Rdb_ErrCode {
};
#endif
#endif // RELATIONAL_ERRNO_CODE_H
#endif // RELATIONAL_STORE_ERRNO_CODE_H

View File

@ -20,7 +20,7 @@
#include "logger.h"
#include "oh_cursor.h"
#include "relational_cursor_impl.h"
#include "relational_error_code.h"
#include "relational_store_error_code.h"
#include "rdb_errno.h"
#include "securec.h"

View File

@ -15,7 +15,7 @@
#include "logger.h"
#include "oh_predicates.h"
#include "relational_error_code.h"
#include "relational_store_error_code.h"
#include "relational_predicates_impl.h"
#include "relational_value_object_impl.h"
#include "sqlite_global_config.h"

View File

@ -20,7 +20,7 @@
#include "rdb_helper.h"
#include "rdb_predicates.h"
#include "relational_cursor_impl.h"
#include "relational_error_code.h"
#include "relational_store_error_code.h"
#include "relational_predicates_impl.h"
#include "relational_store_impl.h"
#include "relational_value_object_impl.h"

View File

@ -15,7 +15,7 @@
#include "logger.h"
#include "oh_value_object.h"
#include "relational_error_code.h"
#include "relational_store_error_code.h"
#include "relational_value_object_impl.h"
using namespace OHOS::RdbNdk;

View File

@ -17,7 +17,7 @@
#include "logger.h"
#include "oh_values_bucket.h"
#include "relational_error_code.h"
#include "relational_store_error_code.h"
#include "relational_values_bucket_impl.h"
#include "value_object.h"
#include "securec.h"

View File

@ -18,7 +18,7 @@
#include <string>
#include "common.h"
#include "relational_store.h"
#include "relational_error_code.h"
#include "relational_store_error_code.h"
using namespace testing::ext;
using namespace OHOS::NativeRdb;