From ff85556cec398d2f64b5d9f16d267706f50eb3cd Mon Sep 17 00:00:00 2001 From: lihuihui Date: Mon, 10 Jul 2023 18:14:03 +0800 Subject: [PATCH] rdb Signed-off-by: lihuihui --- bundle.json | 1 + frameworks/js/napi/common/mock/include/js_ability.h | 4 ++++ frameworks/js/napi/common/mock/src/js_ability.cpp | 10 ++++++++++ .../napi/relationalstore/src/napi_rdb_store_helper.cpp | 4 ---- 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/bundle.json b/bundle.json index fb4b2039d..0b2b4e26b 100644 --- a/bundle.json +++ b/bundle.json @@ -53,6 +53,7 @@ "common_event_service", "c_utils", "device_manager", + "ffrt", "hilog", "hitrace", "huks", diff --git a/frameworks/js/napi/common/mock/include/js_ability.h b/frameworks/js/napi/common/mock/include/js_ability.h index 2d149f0fe..47804314b 100644 --- a/frameworks/js/napi/common/mock/include/js_ability.h +++ b/frameworks/js/napi/common/mock/include/js_ability.h @@ -43,6 +43,8 @@ public: int32_t GetArea() const; bool IsSystemAppCalled(); bool IsHasProxyDataConfig() const; + int GetSystemDatabaseDir(const std::string &dataGroupId, std::string &databaseDir); + bool IsStageMode() const; private: int32_t area_ = 0; @@ -54,6 +56,8 @@ private: std::string writePermission_; bool hasProxyDataConfig_ = false; bool isSystemAppCalled_ = false; + bool isStageMode_ = false; + }; class JSAbility final { diff --git a/frameworks/js/napi/common/mock/src/js_ability.cpp b/frameworks/js/napi/common/mock/src/js_ability.cpp index 64af3ce45..3f9d00101 100644 --- a/frameworks/js/napi/common/mock/src/js_ability.cpp +++ b/frameworks/js/napi/common/mock/src/js_ability.cpp @@ -117,5 +117,15 @@ bool Context::IsHasProxyDataConfig() const { return hasProxyDataConfig_; } + +bool Context::IsStageMode() const +{ + return isStageMode_; +} + +int Context::GetSystemDatabaseDir(const std::string &dataGroupId, std::string &databaseDir) +{ + return false; +} } // namespace AppDataMgrJsKit } // namespace OHOS diff --git a/frameworks/js/napi/relationalstore/src/napi_rdb_store_helper.cpp b/frameworks/js/napi/relationalstore/src/napi_rdb_store_helper.cpp index b8f420b0b..e6488a3c4 100644 --- a/frameworks/js/napi/relationalstore/src/napi_rdb_store_helper.cpp +++ b/frameworks/js/napi/relationalstore/src/napi_rdb_store_helper.cpp @@ -98,10 +98,8 @@ int ParseDatabaseDir(const napi_env &env, const napi_value &object, std::shared_ } std::string databaseDir; -#if !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM) && !defined(ANDROID_PLATFORM) && !defined(IOS_PLATFORM) errorCode = context->abilitycontext->GetSystemDatabaseDir(context->config.GetDataGroupId(), databaseDir); CHECK_RETURN_SET((errorCode == E_OK), std::make_shared(E_DATA_GROUP_ID_INVALID)); -#endif std::string realPath = RdbSqlUtils::GetDefaultDatabasePath(databaseDir, databaseName, errorCode); CHECK_RETURN_SET(errorCode == E_OK, std::make_shared("config", "a StoreConfig.")); @@ -144,9 +142,7 @@ int ParseDataGroupId(const napi_env &env, const napi_value &object, std::shared_ std::string dataGroupId = JSUtils::Convert2String(env, value); CHECK_RETURN_SET(!dataGroupId.empty(), std::make_shared ("StoreConfig.dataGroupId", "not empty.")); -#if !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM) && !defined(ANDROID_PLATFORM) && !defined(IOS_PLATFORM) CHECK_RETURN_SET(context->abilitycontext->IsStageMode(), std::make_shared(E_NOT_STAGE_MODE)); -#endif context->config.SetDataGroupId(JSUtils::Convert2String(env, value)); } return OK;