diff --git a/bundle.json b/bundle.json index 4d0ed1284..dac9534b0 100644 --- a/bundle.json +++ b/bundle.json @@ -109,7 +109,6 @@ "rdb_store_config.h", "result_set.h", "shared_result_set.h", - "transaction_observer.h", "value_object.h", "values_bucket.h" ], diff --git a/frameworks/common/include/logger.h b/frameworks/common/include/logger.h index a54a5bc07..ba67d14b4 100755 --- a/frameworks/common/include/logger.h +++ b/frameworks/common/include/logger.h @@ -19,10 +19,12 @@ #include "hilog/log.h" namespace OHOS { +namespace Rdb { static inline OHOS::HiviewDFX::HiLogLabel LogLabel() { return { LOG_CORE, 0xD001650, "Rdb" }; } +} // namespace Rdb namespace RdbNdk { static inline OHOS::HiviewDFX::HiLogLabel LogLabel() @@ -38,55 +40,50 @@ static inline OHOS::HiviewDFX::HiLogLabel LogLabel() do { \ using HiLog = OHOS::HiviewDFX::HiLog; \ auto lable = LogLabel(); \ - if (!HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_DEBUG)) { \ - break; \ + if (HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_DEBUG)) { \ + HiLog::Debug(lable, "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ + ##__VA_ARGS__); \ } \ - HiLog::Debug(lable, LOG_TAG "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ - ##__VA_ARGS__); \ } while (0) -#define LOG_INFO(fmt, ...) \ - do { \ - using HiLog = OHOS::HiviewDFX::HiLog; \ - auto lable = LogLabel(); \ - if (!HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_INFO)) { \ - break; \ - } \ - HiLog::Info(lable, LOG_TAG "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ - ##__VA_ARGS__); \ +#define LOG_INFO(fmt, ...) \ + do { \ + using HiLog = OHOS::HiviewDFX::HiLog; \ + auto lable = LogLabel(); \ + if (HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_INFO)) { \ + HiLog::Info(lable, "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ + ##__VA_ARGS__); \ + } \ } while (0) -#define LOG_WARN(fmt, ...) \ - do { \ - using HiLog = OHOS::HiviewDFX::HiLog; \ - auto lable = LogLabel(); \ - if (!HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_WARN)) { \ - break; \ - } \ - HiLog::Warn(lable, LOG_TAG "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ - ##__VA_ARGS__); \ +#define LOG_WARN(fmt, ...) \ + do { \ + using HiLog = OHOS::HiviewDFX::HiLog; \ + auto lable = LogLabel(); \ + if (HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_WARN)) { \ + HiLog::Warn(lable, "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ + ##__VA_ARGS__); \ + } \ } while (0) #define LOG_ERROR(fmt, ...) \ do { \ using HiLog = OHOS::HiviewDFX::HiLog; \ auto lable = LogLabel(); \ - if (!HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_ERROR)) { \ - break; \ + if (HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_ERROR)) { \ + HiLog::Error(lable, "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ + ##__VA_ARGS__); \ } \ - HiLog::Error(lable, LOG_TAG "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ - ##__VA_ARGS__); \ } while (0) #define LOG_FATAL(fmt, ...) \ do { \ using HiLog = OHOS::HiviewDFX::HiLog; \ auto lable = LogLabel(); \ - if (!HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_FATAL)) { \ - break; \ + if (HiLogIsLoggable(lable.domain, lable.tag, LogLevel::LOG_FATAL)) { \ + HiLog::Fatal(lable, "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ + ##__VA_ARGS__); \ } \ - HiLog::Fatal(lable, LOG_TAG "::[%{public}s()-%{public}s:%{public}d]: " fmt, __FUNCTION__, FILENAME, __LINE__, \ - ##__VA_ARGS__); \ } while (0) #endif // RDB_LOGGER_H diff --git a/frameworks/js/napi/cloud_data/include/js_config.h b/frameworks/js/napi/cloud_data/include/js_config.h index ff3b4ea7f..6bf77d689 100644 --- a/frameworks/js/napi/cloud_data/include/js_config.h +++ b/frameworks/js/napi/cloud_data/include/js_config.h @@ -15,9 +15,9 @@ #ifndef LDBPROJ_JS_CONFIG_H #define LDBPROJ_JS_CONFIG_H + #include "cloud_manager.h" #include "js_const_properties.h" -#include "log_print.h" namespace OHOS::CloudData { class JsConfig { diff --git a/frameworks/js/napi/cloud_data/include/js_error_utils.h b/frameworks/js/napi/cloud_data/include/js_error_utils.h index d3bb19a12..93d9d5d0b 100644 --- a/frameworks/js/napi/cloud_data/include/js_error_utils.h +++ b/frameworks/js/napi/cloud_data/include/js_error_utils.h @@ -15,12 +15,12 @@ #ifndef LDBPROJ_JS_ERROR_UTILS_H #define LDBPROJ_JS_ERROR_UTILS_H + #include #include #include "cloud_service.h" #include "js_native_api.h" -#include "log_print.h" #include "napi/native_common.h" namespace OHOS { diff --git a/frameworks/js/napi/cloud_data/include/napi_queue.h b/frameworks/js/napi/cloud_data/include/napi_queue.h index e21cbc838..b1f8b0459 100644 --- a/frameworks/js/napi/cloud_data/include/napi_queue.h +++ b/frameworks/js/napi/cloud_data/include/napi_queue.h @@ -12,18 +12,22 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + #ifndef LDBPROJ_NAPI_QUEUE_H #define LDBPROJ_NAPI_QUEUE_H + #include #include #include -#include "log_print.h" +#include "logger.h" #include "napi/native_api.h" #include "napi/native_common.h" #include "napi/native_node_api.h" namespace OHOS::CloudData { +using namespace OHOS::Rdb; + constexpr size_t ARGC_MAX = 6; using NapiCbInfoParser = std::function; using NapiAsyncExecute = std::function; @@ -57,40 +61,40 @@ private: }; /* check condition related to argc/argv, return and logging. */ -#define ASSERT_ARGS(ctxt, condition, message) \ - do { \ - if (!(condition)) { \ - (ctxt)->status = napi_invalid_arg; \ - (ctxt)->error = std::string(message); \ - ZLOGE("test (" #condition ") failed: " message); \ - return; \ - } \ +#define ASSERT_ARGS(ctxt, condition, message) \ + do { \ + if (!(condition)) { \ + (ctxt)->status = napi_invalid_arg; \ + (ctxt)->error = std::string(message); \ + LOG_ERROR("test (" #condition ") failed: " message); \ + return; \ + } \ } while (0) -#define ASSERT_STATUS(ctxt, message) \ - do { \ - if ((ctxt)->status != napi_ok) { \ - (ctxt)->error = std::string(message); \ - ZLOGE("test (ctxt->status == napi_ok) failed: " message); \ - return; \ - } \ +#define ASSERT_STATUS(ctxt, message) \ + do { \ + if ((ctxt)->status != napi_ok) { \ + (ctxt)->error = std::string(message); \ + LOG_ERROR("test (ctxt->status == napi_ok) failed: " message); \ + return; \ + } \ } while (0) /* check condition, return and logging if condition not true. */ -#define ASSERT(condition, message, retVal) \ - do { \ - if (!(condition)) { \ - ZLOGE("test (" #condition ") failed: " message); \ - return retVal; \ - } \ +#define ASSERT(condition, message, retVal) \ + do { \ + if (!(condition)) { \ + LOG_ERROR("test (" #condition ") failed: " message); \ + return retVal; \ + } \ } while (0) -#define ASSERT_VOID(condition, message) \ - do { \ - if (!(condition)) { \ - ZLOGE("test (" #condition ") failed: " message); \ - return; \ - } \ +#define ASSERT_VOID(condition, message) \ + do { \ + if (!(condition)) { \ + LOG_ERROR("test (" #condition ") failed: " message); \ + return; \ + } \ } while (0) #define ASSERT_NULL(condition, message) ASSERT(condition, message, nullptr) diff --git a/frameworks/js/napi/cloud_data/src/entry_point.cpp b/frameworks/js/napi/cloud_data/src/entry_point.cpp index a6f5e84af..8dd249b99 100644 --- a/frameworks/js/napi/cloud_data/src/entry_point.cpp +++ b/frameworks/js/napi/cloud_data/src/entry_point.cpp @@ -12,18 +12,19 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "EntryPoint" + #include "js_config.h" #include "js_const_properties.h" -#include "log_print.h" +#include "logger.h" using namespace OHOS::CloudData; +using namespace OHOS::Rdb; static napi_value Init(napi_env env, napi_value exports) { exports = JsConfig::InitConfig(env, exports); napi_status status = InitConstProperties(env, exports); - ZLOGI("init Enumerate Constants %{public}d", status); + LOG_INFO("init Enumerate Constants %{public}d", status); return exports; } @@ -37,5 +38,5 @@ static __attribute__((constructor)) void RegisterModule() .nm_priv = ((void *)0), .reserved = { 0 } }; napi_module_register(&module); - ZLOGI("module register data.cloudData"); + LOG_INFO("module register data.cloudData"); } diff --git a/frameworks/js/napi/cloud_data/src/js_config.cpp b/frameworks/js/napi/cloud_data/src/js_config.cpp index cb0dbd999..9ca90b2b4 100644 --- a/frameworks/js/napi/cloud_data/src/js_config.cpp +++ b/frameworks/js/napi/cloud_data/src/js_config.cpp @@ -12,19 +12,20 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "JsConfig" + #include "js_config.h" +#include #include #include "cloud_manager.h" #include "cloud_service.h" #include "js_error_utils.h" #include "js_utils.h" -#include "log_print.h" +#include "logger.h" #include "napi_queue.h" -#include +using namespace OHOS::Rdb; using namespace OHOS::CloudData; using namespace OHOS::AppDataMgrJsKit; JsConfig::JsConfig() @@ -79,7 +80,7 @@ napi_value JsConfig::EnableCloud(napi_env env, napi_callback_info info) return; } int32_t cStatus = proxy->EnableCloud(ctxt->accountId, ctxt->switches); - ZLOGD("EnableCloud return %{public}d", cStatus); + LOG_DEBUG("EnableCloud return %{public}d", cStatus); ctxt->status = (GenerateNapiError(cStatus, ctxt->jsCode, ctxt->error) == Status::SUCCESS) ? napi_ok : napi_generic_failure; @@ -123,7 +124,7 @@ napi_value JsConfig::DisableCloud(napi_env env, napi_callback_info info) return; } int32_t cStatus = proxy->DisableCloud(ctxt->accountId); - ZLOGD("DisableCloud return %{public}d", cStatus); + LOG_DEBUG("DisableCloud return %{public}d", cStatus); ctxt->status = (GenerateNapiError(cStatus, ctxt->jsCode, ctxt->error) == Status::SUCCESS) ? napi_ok : napi_generic_failure; @@ -177,7 +178,7 @@ napi_value JsConfig::ChangeAppCloudSwitch(napi_env env, napi_callback_info info) return; } int32_t cStatus = proxy->ChangeAppSwitch(ctxt->accountId, ctxt->bundleName, ctxt->state); - ZLOGD("ChangeAppCloudSwitch return %{public}d", cStatus); + LOG_DEBUG("ChangeAppCloudSwitch return %{public}d", cStatus); ctxt->status = (GenerateNapiError(cStatus, ctxt->jsCode, ctxt->error) == Status::SUCCESS) ? napi_ok : napi_generic_failure; @@ -229,7 +230,7 @@ napi_value JsConfig::Clean(napi_env env, napi_callback_info info) return; } int32_t cStatus = proxy->Clean(ctxt->accountId, ctxt->appActions); - ZLOGD("Clean return %{public}d", cStatus); + LOG_DEBUG("Clean return %{public}d", cStatus); ctxt->status = (GenerateNapiError(cStatus, ctxt->jsCode, ctxt->error) == Status::SUCCESS) ? napi_ok : napi_generic_failure; @@ -277,7 +278,7 @@ napi_value JsConfig::NotifyDataChange(napi_env env, napi_callback_info info) return; } int32_t cStatus = proxy->NotifyDataChange(ctxt->accountId, ctxt->bundleName); - ZLOGD("NotifyDataChange return %{public}d", cStatus); + LOG_DEBUG("NotifyDataChange return %{public}d", cStatus); ctxt->status = (GenerateNapiError(cStatus, ctxt->jsCode, ctxt->error) == Status::SUCCESS) ? napi_ok : napi_generic_failure; @@ -297,7 +298,7 @@ napi_value JsConfig::New(napi_env env, napi_callback_info info) } auto finalize = [](napi_env env, void *data, void *hint) { - ZLOGD("cloudConfig finalize."); + LOG_DEBUG("cloudConfig finalize."); auto *config = reinterpret_cast(data); ASSERT_VOID(config != nullptr, "finalize null!"); delete config; @@ -306,7 +307,7 @@ napi_value JsConfig::New(napi_env env, napi_callback_info info) ASSERT_ERR(env, cloudConfig != nullptr, Status::INVALID_ARGUMENT, "no memory for cloudConfig."); napi_status status = napi_wrap(env, self, cloudConfig, finalize, nullptr, nullptr); if (status != napi_ok) { - ZLOGE("JsConfig::Initialize napi_wrap failed! code:%{public}d!", status); + LOG_ERROR("JsConfig::Initialize napi_wrap failed! code:%{public}d!", status); finalize(env, cloudConfig, nullptr); return nullptr; } diff --git a/frameworks/js/napi/cloud_data/src/js_const_properties.cpp b/frameworks/js/napi/cloud_data/src/js_const_properties.cpp index 60f4df42a..ea0bbe51b 100644 --- a/frameworks/js/napi/cloud_data/src/js_const_properties.cpp +++ b/frameworks/js/napi/cloud_data/src/js_const_properties.cpp @@ -12,14 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "Const_Properties" + #include "js_const_properties.h" #include "cloud_service.h" -#include "log_print.h" #include "napi_queue.h" +using namespace OHOS::Rdb; using Action = OHOS::CloudData::CloudService::Action; + namespace OHOS::CloudData { static napi_status SetNamedProperty(napi_env env, napi_value &obj, const std::string &name, int32_t value) { diff --git a/frameworks/js/napi/cloud_data/src/js_error_utils.cpp b/frameworks/js/napi/cloud_data/src/js_error_utils.cpp index 246a50767..11d797be3 100644 --- a/frameworks/js/napi/cloud_data/src/js_error_utils.cpp +++ b/frameworks/js/napi/cloud_data/src/js_error_utils.cpp @@ -12,13 +12,15 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "JS_ERROR_UTILS" #include "js_error_utils.h" #include +#include "logger.h" + namespace OHOS::CloudData { +using namespace OHOS::Rdb; using JsErrorCode = OHOS::CloudData::JsErrorCode; static constexpr JsErrorCode JS_ERROR_CODE_MSGS[] = { @@ -55,7 +57,7 @@ Status GenerateNapiError(int32_t status, int32_t &errCode, std::string &errMessa errCode = -1; errMessage = ""; } - ZLOGD("GenerateNapiError errCode is %{public}d", errCode); + LOG_DEBUG("GenerateNapiError errCode is %{public}d", errCode); if (errCode == 0) { return Status::SUCCESS; } @@ -64,7 +66,7 @@ Status GenerateNapiError(int32_t status, int32_t &errCode, std::string &errMessa void ThrowNapiError(napi_env env, int32_t status, const std::string &errMessage, bool isParamsCheck) { - ZLOGD("ThrowNapiError message: %{public}s", errMessage.c_str()); + LOG_DEBUG("ThrowNapiError message: %{public}s", errMessage.c_str()); if (status == Status::SUCCESS) { return; } diff --git a/frameworks/js/napi/cloud_data/src/napi_queue.cpp b/frameworks/js/napi/cloud_data/src/napi_queue.cpp index 3647dc975..16eb9dd8f 100644 --- a/frameworks/js/napi/cloud_data/src/napi_queue.cpp +++ b/frameworks/js/napi/cloud_data/src/napi_queue.cpp @@ -12,21 +12,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "NapiQueue" + #include "napi_queue.h" +#include "logger.h" + namespace OHOS::CloudData { +using namespace OHOS::Rdb; + ContextBase::~ContextBase() { - ZLOGD("no memory leak after callback or promise[resolved/rejected]"); + LOG_DEBUG("no memory leak after callback or promise[resolved/rejected]"); if (env != nullptr) { if (callbackRef != nullptr) { auto status = napi_delete_reference(env, callbackRef); - ZLOGD("status:%{public}d", status); + LOG_DEBUG("status:%{public}d", status); } if (selfRef != nullptr) { auto status = napi_delete_reference(env, selfRef); - ZLOGD("status:%{public}d", status); + LOG_DEBUG("status:%{public}d", status); } env = nullptr; } @@ -56,9 +60,9 @@ void ContextBase::GetCbInfo(napi_env envi, napi_callback_info info, NapiCbInfoPa status = napi_create_reference(env, argv[index], 1, &callbackRef); ASSERT_STATUS(this, "ref callback failed!"); argc = index; - ZLOGD("async callback, no promise"); + LOG_DEBUG("async callback, no promise"); } else { - ZLOGD("no callback, async pormose"); + LOG_DEBUG("no callback, async pormose"); } } @@ -72,7 +76,7 @@ void ContextBase::GetCbInfo(napi_env envi, napi_callback_info info, NapiCbInfoPa napi_value NapiQueue::AsyncWork(napi_env env, std::shared_ptr ctxt, const std::string &name, NapiAsyncExecute execute, NapiAsyncComplete complete) { - ZLOGD("name=%{public}s", name.c_str()); + LOG_DEBUG("name=%{public}s", name.c_str()); AsyncContext *aCtx = new (std::nothrow) AsyncContext; if (aCtx == nullptr) { return nullptr; @@ -84,7 +88,7 @@ napi_value NapiQueue::AsyncWork(napi_env env, std::shared_ptr ctxt, napi_value promise = nullptr; if (aCtx->ctx->callbackRef == nullptr) { napi_create_promise(env, &aCtx->deferred, &promise); - ZLOGD("create deferred promise"); + LOG_DEBUG("create deferred promise"); } else { napi_get_undefined(env, &promise); } @@ -96,7 +100,7 @@ napi_value NapiQueue::AsyncWork(napi_env env, std::shared_ptr ctxt, [](napi_env env, void *data) { ASSERT_VOID(data != nullptr, "napi_async_execute_callback nullptr"); auto actx = reinterpret_cast(data); - ZLOGD("napi_async_execute_callback ctxt->status=%{public}d", actx->ctx->status); + LOG_DEBUG("napi_async_execute_callback ctxt->status=%{public}d", actx->ctx->status); if (actx->execute && actx->ctx->status == napi_ok) { actx->execute(); } @@ -104,7 +108,8 @@ napi_value NapiQueue::AsyncWork(napi_env env, std::shared_ptr ctxt, [](napi_env env, napi_status status, void *data) { ASSERT_VOID(data != nullptr, "napi_async_complete_callback nullptr"); auto actx = reinterpret_cast(data); - ZLOGD("napi_async_complete_callback status=%{public}d, ctxt->status=%{public}d", status, actx->ctx->status); + LOG_DEBUG("napi_async_complete_callback status=%{public}d, ctxt->status=%{public}d", + status, actx->ctx->status); if ((status != napi_ok) && (actx->ctx->status == napi_ok)) { actx->ctx->status = status; } @@ -149,17 +154,17 @@ void NapiQueue::GenerateOutput(AsyncContext &ctx, napi_value output) } if (ctx.deferred != nullptr) { if (ctx.ctx->status == napi_ok) { - ZLOGD("deferred promise resolved"); + LOG_DEBUG("deferred promise resolved"); napi_resolve_deferred(ctx.env, ctx.deferred, result[RESULT_DATA]); } else { - ZLOGD("deferred promise rejected"); + LOG_DEBUG("deferred promise rejected"); napi_reject_deferred(ctx.env, ctx.deferred, result[RESULT_ERROR]); } } else { napi_value callback = nullptr; napi_get_reference_value(ctx.env, ctx.ctx->callbackRef, &callback); napi_value callbackResult = nullptr; - ZLOGD("call callback function"); + LOG_DEBUG("call callback function"); napi_call_function(ctx.env, nullptr, callback, RESULT_ALL, result, &callbackResult); } } diff --git a/frameworks/js/napi/common/src/js_ability.cpp b/frameworks/js/napi/common/src/js_ability.cpp index d09d628a8..dcc13d0e7 100644 --- a/frameworks/js/napi/common/src/js_ability.cpp +++ b/frameworks/js/napi/common/src/js_ability.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "JsAbility" - #include "js_ability.h" #include "extension_context.h" @@ -22,6 +20,8 @@ namespace OHOS { namespace AppDataMgrJsKit { +using namespace OHOS::Rdb; + Context::Context(std::shared_ptr stageContext) { databaseDir_ = stageContext->GetDatabaseDir(); diff --git a/frameworks/js/napi/common/src/js_utils.cpp b/frameworks/js/napi/common/src/js_utils.cpp index 52a6eeda4..1b180d002 100644 --- a/frameworks/js/napi/common/src/js_utils.cpp +++ b/frameworks/js/napi/common/src/js_utils.cpp @@ -12,12 +12,12 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "JsUtils" #include "js_utils.h" - #include "logger.h" +using namespace OHOS::Rdb; + #define CHECK_RETURN_RET(assertion, message, revt) \ do { \ if (!(assertion)) { \ diff --git a/frameworks/js/napi/dataability/src/entry_point.cpp b/frameworks/js/napi/dataability/src/entry_point.cpp index c71ba70ba..4401f4911 100644 --- a/frameworks/js/napi/dataability/src/entry_point.cpp +++ b/frameworks/js/napi/dataability/src/entry_point.cpp @@ -13,16 +13,11 @@ * limitations under the License. */ -#define LOG_TAG "EntryPoint" - -#include "logger.h" - #include "napi/native_api.h" #include "napi/native_node_api.h" #include "napi_data_ability_predicates.h" #include "napi_predicates_utils.h" -using namespace OHOS; using namespace OHOS::DataAbilityJsKit; EXTERN_C_START @@ -56,5 +51,4 @@ static napi_module _module = { static __attribute__((constructor)) void RegisterModule(void) { napi_module_register(&_module); - LOG_INFO("module register data.dataAbility"); } diff --git a/frameworks/js/napi/dataability/src/napi_data_ability_predicates.cpp b/frameworks/js/napi/dataability/src/napi_data_ability_predicates.cpp index 36b03f16a..163ee0e11 100644 --- a/frameworks/js/napi/dataability/src/napi_data_ability_predicates.cpp +++ b/frameworks/js/napi/dataability/src/napi_data_ability_predicates.cpp @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "JsDataAbilityPredicates" #include "napi_data_ability_predicates.h" @@ -20,6 +19,7 @@ #include "logger.h" #include "napi_async_proxy.h" +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::AppDataMgrJsKit; diff --git a/frameworks/js/napi/dataability/src/napi_predicates_utils.cpp b/frameworks/js/napi/dataability/src/napi_predicates_utils.cpp index 6299dcd80..11e51d124 100644 --- a/frameworks/js/napi/dataability/src/napi_predicates_utils.cpp +++ b/frameworks/js/napi/dataability/src/napi_predicates_utils.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "JsPredicatesUtils" - #include "napi_predicates_utils.h" #include "js_utils.h" @@ -23,6 +21,7 @@ #include "napi_rdb_predicates.h" #include "predicates_utils.h" +using namespace OHOS::Rdb; using namespace OHOS::AppDataMgrJsKit; namespace OHOS { diff --git a/frameworks/js/napi/rdb/BUILD.gn b/frameworks/js/napi/rdb/BUILD.gn index c7d4494b9..87bfde496 100644 --- a/frameworks/js/napi/rdb/BUILD.gn +++ b/frameworks/js/napi/rdb/BUILD.gn @@ -91,6 +91,7 @@ ohos_shared_library("napi_rdb") { } subsystem_name = "distributeddatamgr" + innerapi_tags = [ "platformsdk" ] part_name = "relational_store" } @@ -100,7 +101,6 @@ ohos_shared_library("rdb") { if (is_mingw || is_mac) { include_dirs = [ "mock/include", - "${relational_store_common_path}/include", "${relational_store_js_common_path}/mock/include", "${relational_store_napi_path}/rdb/mock/include", "//commonlibrary/c_utils/base/include", @@ -129,7 +129,6 @@ ohos_shared_library("rdb") { include_dirs = [ "include", "${datashare_path}/common/include/", - "${relational_store_common_path}/include", "${relational_store_js_common_path}/include", "${relational_store_napi_path}/rdb/include", ] diff --git a/frameworks/js/napi/rdb/include/napi_rdb_error.h b/frameworks/js/napi/rdb/include/napi_rdb_error.h index 19578ca77..946a1198a 100644 --- a/frameworks/js/napi/rdb/include/napi_rdb_error.h +++ b/frameworks/js/napi/rdb/include/napi_rdb_error.h @@ -19,6 +19,8 @@ namespace OHOS { namespace AppDataMgrJsKit { +using namespace OHOS; + constexpr int MAX_INPUT_COUNT = 10; constexpr int OK = 0; constexpr int ERR = -1; diff --git a/frameworks/js/napi/rdb/src/entry_point.cpp b/frameworks/js/napi/rdb/src/entry_point.cpp index d1b2d16c6..21a6d6bdb 100644 --- a/frameworks/js/napi/rdb/src/entry_point.cpp +++ b/frameworks/js/napi/rdb/src/entry_point.cpp @@ -13,17 +13,12 @@ * limitations under the License. */ -#define LOG_TAG "EntryPoint" - -#include "logger.h" - #include "napi_rdb_predicates.h" #include "napi_rdb_store.h" #include "napi_rdb_store_helper.h" #include "napi_rdb_const_properties.h" #include "napi/native_api.h" -using namespace OHOS; using namespace OHOS::RdbJsKit; EXTERN_C_START @@ -59,5 +54,4 @@ static napi_module _module = { static __attribute__((constructor)) void RegisterModule(void) { napi_module_register(&_module); - LOG_INFO("module register data.rdb"); } diff --git a/frameworks/js/napi/rdb/src/napi_async_call.cpp b/frameworks/js/napi/rdb/src/napi_async_call.cpp index a32e9e743..ed7ebbbd2 100644 --- a/frameworks/js/napi/rdb/src/napi_async_call.cpp +++ b/frameworks/js/napi/rdb/src/napi_async_call.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "JsSyncCall" - #include "napi_async_call.h" #include "logger.h" @@ -22,6 +20,8 @@ namespace OHOS { namespace AppDataMgrJsKit { +using namespace OHOS::Rdb; + void BaseContext::SetAction( napi_env env, napi_callback_info info, InputAction input, ExecuteAction exec, OutputAction output) { diff --git a/frameworks/js/napi/rdb/src/napi_rdb_js_utils.cpp b/frameworks/js/napi/rdb/src/napi_rdb_js_utils.cpp index caabdf83d..566e4b1c8 100644 --- a/frameworks/js/napi/rdb/src/napi_rdb_js_utils.cpp +++ b/frameworks/js/napi/rdb/src/napi_rdb_js_utils.cpp @@ -13,15 +13,16 @@ * limitations under the License. */ -#define LOG_TAG "JsRdbJsUtils" - #include "napi_rdb_js_utils.h" #include "logger.h" #include "result_set.h" + namespace OHOS::AppDataMgrJsKit { namespace JSUtils { +using namespace OHOS::Rdb; using namespace NativeRdb; + template<> int32_t Convert2Value(napi_env env, napi_value jsValue, Asset &output) { diff --git a/frameworks/js/napi/rdb/src/napi_rdb_predicates.cpp b/frameworks/js/napi/rdb/src/napi_rdb_predicates.cpp index edb518b9e..4d24dcc8a 100644 --- a/frameworks/js/napi/rdb/src/napi_rdb_predicates.cpp +++ b/frameworks/js/napi/rdb/src/napi_rdb_predicates.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "JsRdbPredicates" - #include "napi_rdb_predicates.h" #include "js_utils.h" @@ -22,6 +20,7 @@ #include "napi_rdb_error.h" #include "napi_rdb_trace.h" +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::AppDataMgrJsKit; diff --git a/frameworks/js/napi/rdb/src/napi_rdb_store.cpp b/frameworks/js/napi/rdb/src/napi_rdb_store.cpp index 56ef34a4f..294312770 100644 --- a/frameworks/js/napi/rdb/src/napi_rdb_store.cpp +++ b/frameworks/js/napi/rdb/src/napi_rdb_store.cpp @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "JsRdbStore" #include "napi_rdb_store.h" @@ -34,6 +33,7 @@ using namespace OHOS::DataShare; #endif +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::AppDataMgrJsKit; diff --git a/frameworks/js/napi/rdb/src/napi_rdb_store_helper.cpp b/frameworks/js/napi/rdb/src/napi_rdb_store_helper.cpp index 523a7f18b..66c0f6d89 100644 --- a/frameworks/js/napi/rdb/src/napi_rdb_store_helper.cpp +++ b/frameworks/js/napi/rdb/src/napi_rdb_store_helper.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "JsRdbStoreHelper" - #include "napi_rdb_store_helper.h" #include @@ -34,6 +32,7 @@ #include "sqlite_database_utils.h" #include "unistd.h" +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::AppDataMgrJsKit; diff --git a/frameworks/js/napi/rdb/src/napi_rdb_store_observer.cpp b/frameworks/js/napi/rdb/src/napi_rdb_store_observer.cpp index 307f78daa..14f69bcfb 100644 --- a/frameworks/js/napi/rdb/src/napi_rdb_store_observer.cpp +++ b/frameworks/js/napi/rdb/src/napi_rdb_store_observer.cpp @@ -13,13 +13,12 @@ * limitations under the License. */ -#define LOG_TAG "JsRdbStoreObserver" - #include "napi_rdb_store_observer.h" #include "js_utils.h" #include "logger.h" +using namespace OHOS::Rdb; using namespace OHOS::AppDataMgrJsKit; namespace OHOS::RdbJsKit { diff --git a/frameworks/js/napi/rdb/src/napi_result_set.cpp b/frameworks/js/napi/rdb/src/napi_result_set.cpp index 48ab547d6..39c42efd2 100644 --- a/frameworks/js/napi/rdb/src/napi_result_set.cpp +++ b/frameworks/js/napi/rdb/src/napi_result_set.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "JsResultSet" - #include "napi_result_set.h" #include @@ -31,6 +29,7 @@ #include "string_ex.h" #endif +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::AppDataMgrJsKit; diff --git a/frameworks/js/napi/rdb/src/napi_uv_queue.cpp b/frameworks/js/napi/rdb/src/napi_uv_queue.cpp index b6abcb793..442cd6106 100644 --- a/frameworks/js/napi/rdb/src/napi_uv_queue.cpp +++ b/frameworks/js/napi/rdb/src/napi_uv_queue.cpp @@ -13,14 +13,14 @@ * limitations under the License. */ -#define LOG_TAG "JsUvQueue" - #include "napi_uv_queue.h" #include "logger.h" #include "uv.h" namespace OHOS::RdbJsKit { +using namespace OHOS::Rdb; + NapiUvQueue::NapiUvQueue(napi_env env, napi_value callback) : env_(env) { diff --git a/frameworks/js/napi/rdb/src/napi_values_bucket.cpp b/frameworks/js/napi/rdb/src/napi_values_bucket.cpp index edf37106e..458f4215d 100644 --- a/frameworks/js/napi/rdb/src/napi_values_bucket.cpp +++ b/frameworks/js/napi/rdb/src/napi_values_bucket.cpp @@ -13,15 +13,13 @@ * limitations under the License. */ -#define LOG_TAG "JsValuesBucket" - #include "napi_values_bucket.h" #include "js_utils.h" #include "logger.h" #include "value_object.h" -using namespace OHOS; +using namespace OHOS::Rdb; using namespace OHOS::AppDataMgrJsKit; using namespace OHOS::NativeRdb; diff --git a/frameworks/js/napi/relationalstore/src/entry_point.cpp b/frameworks/js/napi/relationalstore/src/entry_point.cpp index f90405476..bd71af436 100644 --- a/frameworks/js/napi/relationalstore/src/entry_point.cpp +++ b/frameworks/js/napi/relationalstore/src/entry_point.cpp @@ -13,17 +13,12 @@ * limitations under the License. */ -#define LOG_TAG "EntryPoint" - -#include "logger.h" - #include "napi_rdb_predicates.h" #include "napi_rdb_store.h" #include "napi_rdb_store_helper.h" #include "napi_rdb_const_properties.h" #include "napi/native_api.h" -using namespace OHOS; using namespace OHOS::RelationalStoreJsKit; EXTERN_C_START @@ -59,5 +54,4 @@ static napi_module _module = { static __attribute__((constructor)) void RegisterModule(void) { napi_module_register(&_module); - LOG_INFO("module register data.relationalStore"); } diff --git a/frameworks/js/napi/relationalstore/src/napi_async_call.cpp b/frameworks/js/napi/relationalstore/src/napi_async_call.cpp index 3901f8619..513925a08 100644 --- a/frameworks/js/napi/relationalstore/src/napi_async_call.cpp +++ b/frameworks/js/napi/relationalstore/src/napi_async_call.cpp @@ -13,13 +13,12 @@ * limitations under the License. */ -#define LOG_TAG "AsyncCall" - #include "napi_async_call.h" #include "logger.h" #include "napi_rdb_trace.h" +using namespace OHOS::Rdb; using namespace OHOS::AppDataMgrJsKit; namespace OHOS { diff --git a/frameworks/js/napi/relationalstore/src/napi_rdb_js_utils.cpp b/frameworks/js/napi/relationalstore/src/napi_rdb_js_utils.cpp index e03c1e130..566e4b1c8 100644 --- a/frameworks/js/napi/relationalstore/src/napi_rdb_js_utils.cpp +++ b/frameworks/js/napi/relationalstore/src/napi_rdb_js_utils.cpp @@ -13,15 +13,16 @@ * limitations under the License. */ -#define LOG_TAG "RdbJsUtils" - #include "napi_rdb_js_utils.h" #include "logger.h" #include "result_set.h" + namespace OHOS::AppDataMgrJsKit { namespace JSUtils { +using namespace OHOS::Rdb; using namespace NativeRdb; + template<> int32_t Convert2Value(napi_env env, napi_value jsValue, Asset &output) { diff --git a/frameworks/js/napi/relationalstore/src/napi_rdb_predicates.cpp b/frameworks/js/napi/relationalstore/src/napi_rdb_predicates.cpp index a9b22d464..e8ae2aef9 100644 --- a/frameworks/js/napi/relationalstore/src/napi_rdb_predicates.cpp +++ b/frameworks/js/napi/relationalstore/src/napi_rdb_predicates.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbPredicates" - #include "napi_rdb_predicates.h" #include "js_utils.h" @@ -22,6 +20,7 @@ #include "napi_rdb_error.h" #include "napi_rdb_trace.h" +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::AppDataMgrJsKit; diff --git a/frameworks/js/napi/relationalstore/src/napi_rdb_store.cpp b/frameworks/js/napi/relationalstore/src/napi_rdb_store.cpp index 7ec40f0e9..8500ce34e 100644 --- a/frameworks/js/napi/relationalstore/src/napi_rdb_store.cpp +++ b/frameworks/js/napi/relationalstore/src/napi_rdb_store.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbStore" - #include "napi_rdb_store.h" #include @@ -36,6 +34,7 @@ using namespace OHOS::DataShare; #endif +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::AppDataMgrJsKit; 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 a2b27c5fd..e475a16e2 100644 --- a/frameworks/js/napi/relationalstore/src/napi_rdb_store_helper.cpp +++ b/frameworks/js/napi/relationalstore/src/napi_rdb_store_helper.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbStoreHelper" - #include "napi_rdb_store_helper.h" #include @@ -34,6 +32,7 @@ #include "sqlite_database_utils.h" #include "unistd.h" +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::AppDataMgrJsKit; diff --git a/frameworks/js/napi/relationalstore/src/napi_rdb_store_observer.cpp b/frameworks/js/napi/relationalstore/src/napi_rdb_store_observer.cpp index 332c4590e..5869737b3 100644 --- a/frameworks/js/napi/relationalstore/src/napi_rdb_store_observer.cpp +++ b/frameworks/js/napi/relationalstore/src/napi_rdb_store_observer.cpp @@ -13,13 +13,12 @@ * limitations under the License. */ -#define LOG_TAG "RdbStoreObserver" - #include "napi_rdb_store_observer.h" #include "js_utils.h" #include "logger.h" +using namespace OHOS::Rdb; using namespace OHOS::AppDataMgrJsKit; namespace OHOS::RelationalStoreJsKit { diff --git a/frameworks/js/napi/relationalstore/src/napi_result_set.cpp b/frameworks/js/napi/relationalstore/src/napi_result_set.cpp index d39b96908..2834dca51 100644 --- a/frameworks/js/napi/relationalstore/src/napi_result_set.cpp +++ b/frameworks/js/napi/relationalstore/src/napi_result_set.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbResultSet" - #include "napi_result_set.h" #include @@ -29,6 +27,7 @@ #include "string_ex.h" #endif +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::AppDataMgrJsKit; diff --git a/frameworks/js/napi/relationalstore/src/napi_uv_queue.cpp b/frameworks/js/napi/relationalstore/src/napi_uv_queue.cpp index f00a4316d..795c65abc 100644 --- a/frameworks/js/napi/relationalstore/src/napi_uv_queue.cpp +++ b/frameworks/js/napi/relationalstore/src/napi_uv_queue.cpp @@ -13,14 +13,14 @@ * limitations under the License. */ -#define LOG_TAG "RdbUvQueue" - #include "napi_uv_queue.h" #include "logger.h" #include "uv.h" namespace OHOS::RelationalStoreJsKit { +using namespace OHOS::Rdb; + NapiUvQueue::NapiUvQueue(napi_env env, napi_value callback) : env_(env) { diff --git a/frameworks/native/appdatafwk/src/shared_block.cpp b/frameworks/native/appdatafwk/src/shared_block.cpp index 080ccb9ca..6d41306fa 100644 --- a/frameworks/native/appdatafwk/src/shared_block.cpp +++ b/frameworks/native/appdatafwk/src/shared_block.cpp @@ -12,7 +12,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "SharedBlock" #include "shared_block.h" @@ -30,6 +29,8 @@ namespace OHOS { namespace AppDataFwk { +using namespace OHOS::Rdb; + SharedBlock::SharedBlock(const std::string &name, sptr ashmem, size_t size, bool readOnly) : mName(name), ashmem_(ashmem), mSize(size), mReadOnly(readOnly), mHeader(nullptr) { diff --git a/frameworks/native/cloud_data/src/cloud_manager.cpp b/frameworks/native/cloud_data/src/cloud_manager.cpp index e6d46b9ab..43bf0dd30 100644 --- a/frameworks/native/cloud_data/src/cloud_manager.cpp +++ b/frameworks/native/cloud_data/src/cloud_manager.cpp @@ -13,17 +13,18 @@ * limitations under the License. */ -#define LOG_TAG "CloudManagerImpl" - #include "cloud_manager.h" #include "cloud_service_proxy.h" #include "icloud_service.h" #include "iservice_registry.h" #include "itypes_util.h" -#include "log_print.h" +#include "logger.h" #include "system_ability_definition.h" + namespace OHOS::CloudData { +using namespace OHOS::Rdb; + class DataMgrService : public IRemoteProxy { public: explicit DataMgrService(const sptr &impl); @@ -60,24 +61,24 @@ std::pair> CloudManager::GetCloudService( auto saMgr = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (saMgr == nullptr) { - ZLOGE("get system ability manager failed"); + LOG_ERROR("get system ability manager failed"); return std::make_pair(CloudService::Status::SERVER_UNAVAILABLE, nullptr); } auto dataMgrObject = saMgr->CheckSystemAbility(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID); if (dataMgrObject == nullptr) { - ZLOGE("get distributed data manager failed"); + LOG_ERROR("get distributed data manager failed"); return std::make_pair(CloudService::Status::SERVER_UNAVAILABLE, nullptr); } sptr dataMgr = new (std::nothrow) DataMgrService(dataMgrObject); if (dataMgr == nullptr) { - ZLOGE("new CloudDataServiceProxy failed"); + LOG_ERROR("new CloudDataServiceProxy failed"); return std::make_pair(CloudService::Status::SERVER_UNAVAILABLE, nullptr); } auto cloudObject = dataMgr->GetFeatureInterface(CloudService::SERVICE_NAME); if (cloudObject == nullptr) { - ZLOGE("get cloud service failed"); + LOG_ERROR("get cloud service failed"); return std::make_pair(CloudService::Status::FEATURE_UNAVAILABLE, nullptr); } @@ -100,20 +101,20 @@ std::pair> CloudManager::GetCloudService( DataMgrService::DataMgrService(const sptr &impl) : IRemoteProxy(impl) { - ZLOGI("init proxy"); + LOG_INFO("init proxy"); } sptr DataMgrService::GetFeatureInterface(const std::string &name) { - ZLOGI("%s", name.c_str()); + LOG_INFO("%s", name.c_str()); MessageParcel data; if (!data.WriteInterfaceToken(DataMgrService::GetDescriptor())) { - ZLOGE("write descriptor failed"); + LOG_ERROR("write descriptor failed"); return nullptr; } if (!ITypesUtil::Marshal(data, name)) { - ZLOGE("write descriptor failed"); + LOG_ERROR("write descriptor failed"); return nullptr; } @@ -121,13 +122,13 @@ sptr DataMgrService::GetFeatureInterface(const std::string &name) MessageOption mo{ MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GET_FEATURE_INTERFACE, data, reply, mo); if (error != 0) { - ZLOGE("SendRequest returned %{public}d", error); + LOG_ERROR("SendRequest returned %{public}d", error); return nullptr; } sptr remoteObject; if (!ITypesUtil::Unmarshal(reply, remoteObject)) { - ZLOGE("remote object is nullptr"); + LOG_ERROR("remote object is nullptr"); return nullptr; } return remoteObject; diff --git a/frameworks/native/cloud_data/src/cloud_service_proxy.cpp b/frameworks/native/cloud_data/src/cloud_service_proxy.cpp index a379d0594..1755597cd 100644 --- a/frameworks/native/cloud_data/src/cloud_service_proxy.cpp +++ b/frameworks/native/cloud_data/src/cloud_service_proxy.cpp @@ -13,13 +13,13 @@ * limitations under the License. */ -#define LOG_TAG "CloudServiceProxy" - #include "cloud_service_proxy.h" #include "itypes_util.h" -#include "log_print.h" +#include "logger.h" namespace OHOS::CloudData { +using namespace OHOS::Rdb; + #define IPC_SEND(code, reply, ...) \ ({ \ int32_t __status = SUCCESS; \ @@ -56,7 +56,7 @@ int32_t CloudServiceProxy::EnableCloud(const std::string &id, const std::map(status); } @@ -66,7 +66,7 @@ int32_t CloudServiceProxy::DisableCloud(const std::string &id) MessageParcel reply; int32_t status = IPC_SEND(TRANS_DISABLE_CLOUD, reply, id); if (status != SUCCESS) { - ZLOGE("status:0x%{public}x id:%{public}.6s", status, id.c_str()); + LOG_ERROR("status:0x%{public}x id:%{public}.6s", status, id.c_str()); } return static_cast(status); } @@ -76,7 +76,7 @@ int32_t CloudServiceProxy::ChangeAppSwitch(const std::string &id, const std::str MessageParcel reply; int32_t status = IPC_SEND(TRANS_CHANGE_APP_SWITCH, reply, id, bundleName, appSwitch); if (status != SUCCESS) { - ZLOGE("status:0x%{public}x id:%{public}.6s bundleName:%{public}s switch:%{public}d", + LOG_ERROR("status:0x%{public}x id:%{public}.6s bundleName:%{public}s switch:%{public}d", status, id.c_str(), bundleName.c_str(), appSwitch); } return static_cast(status); @@ -87,7 +87,7 @@ int32_t CloudServiceProxy::Clean(const std::string &id, const std::map(status); } @@ -97,7 +97,7 @@ int32_t CloudServiceProxy::NotifyDataChange(const std::string &id, const std::st MessageParcel reply; int32_t status = IPC_SEND(TRANS_NOTIFY_DATA_CHANGE, reply, id, bundleName); if (status != SUCCESS) { - ZLOGE("status:0x%{public}x id:%{public}.6s bundleName:%{public}s", status, id.c_str(), bundleName.c_str()); + LOG_ERROR("status:0x%{public}x id:%{public}.6s bundleName:%{public}s", status, id.c_str(), bundleName.c_str()); } return static_cast(status); } diff --git a/frameworks/native/dataability/src/ishared_result_set_proxy.cpp b/frameworks/native/dataability/src/ishared_result_set_proxy.cpp index 2c068c547..2e800f4d4 100644 --- a/frameworks/native/dataability/src/ishared_result_set_proxy.cpp +++ b/frameworks/native/dataability/src/ishared_result_set_proxy.cpp @@ -13,14 +13,15 @@ * limitations under the License. */ -#define LOG_TAG "ISharedResultSetProxy" - #include "ishared_result_set_proxy.h" #include "iremote_proxy.h" #include "logger.h" #include "rdb_errno.h" + namespace OHOS::NativeRdb { +using namespace OHOS::Rdb; + std::function( MessageParcel &parcel)> ISharedResultSet::consumerCreator_ = ISharedResultSetProxy::CreateProxy; BrokerDelegator ISharedResultSetProxy::delegator_; diff --git a/frameworks/native/dataability/src/ishared_result_set_stub.cpp b/frameworks/native/dataability/src/ishared_result_set_stub.cpp index 5d4f7f907..1ab671663 100644 --- a/frameworks/native/dataability/src/ishared_result_set_stub.cpp +++ b/frameworks/native/dataability/src/ishared_result_set_stub.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "ISharedResultSetStub" - #include "ishared_result_set_stub.h" #include @@ -23,6 +21,8 @@ #include "rdb_errno.h" namespace OHOS::NativeRdb { +using namespace OHOS::Rdb; + std::function(std::shared_ptr, MessageParcel &)> ISharedResultSet::providerCreator_ = ISharedResultSetStub::CreateStub; constexpr ISharedResultSetStub::Handler ISharedResultSetStub::handlers[ISharedResultSet::FUNC_BUTT]; diff --git a/frameworks/native/rdb/include/rdb_store_impl.h b/frameworks/native/rdb/include/rdb_store_impl.h index dbee736dd..a5e4d8882 100644 --- a/frameworks/native/rdb/include/rdb_store_impl.h +++ b/frameworks/native/rdb/include/rdb_store_impl.h @@ -26,7 +26,6 @@ #include "rdb_store_config.h" #include "sqlite_connection_pool.h" #include "sqlite_statement.h" -#include "transaction_observer.h" namespace OHOS { class ExecutorPool; diff --git a/frameworks/native/rdb/mock/include/rdb_store_impl.h b/frameworks/native/rdb/mock/include/rdb_store_impl.h index 2cfc754d8..ca36024f2 100644 --- a/frameworks/native/rdb/mock/include/rdb_store_impl.h +++ b/frameworks/native/rdb/mock/include/rdb_store_impl.h @@ -26,7 +26,6 @@ #include "rdb_store_config.h" #include "sqlite_connection_pool.h" #include "sqlite_statement.h" -#include "transaction_observer.h" namespace OHOS::NativeRdb { class RdbStoreImpl : public RdbStore, public std::enable_shared_from_this { diff --git a/frameworks/native/rdb/src/abs_predicates.cpp b/frameworks/native/rdb/src/abs_predicates.cpp index 119b8500d..ce7116e01 100644 --- a/frameworks/native/rdb/src/abs_predicates.cpp +++ b/frameworks/native/rdb/src/abs_predicates.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "AbsPredicates" - #include "abs_predicates.h" #include @@ -27,6 +25,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + AbsPredicates::AbsPredicates() { Initial(); diff --git a/frameworks/native/rdb/src/abs_rdb_predicates.cpp b/frameworks/native/rdb/src/abs_rdb_predicates.cpp index 82d125f78..dabee48e1 100644 --- a/frameworks/native/rdb/src/abs_rdb_predicates.cpp +++ b/frameworks/native/rdb/src/abs_rdb_predicates.cpp @@ -13,14 +13,14 @@ * limitations under the License. */ -#define LOG_TAG "AbsRdbPredicates" - #include "abs_rdb_predicates.h" #include "logger.h" #include "rdb_trace.h" namespace OHOS::NativeRdb { +using namespace OHOS::Rdb; + AbsRdbPredicates::AbsRdbPredicates(std::string tableName) { if (tableName.empty()) { diff --git a/frameworks/native/rdb/src/abs_result_set.cpp b/frameworks/native/rdb/src/abs_result_set.cpp index 4d0110657..65f3371ba 100644 --- a/frameworks/native/rdb/src/abs_result_set.cpp +++ b/frameworks/native/rdb/src/abs_result_set.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "AbsResultSet" - #include "abs_result_set.h" #include @@ -27,6 +25,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + void RowEntity::Put(const std::string &name, const ValueObject &value) { auto it = values_.emplace(name, std::move(value)); diff --git a/frameworks/native/rdb/src/abs_shared_result_set.cpp b/frameworks/native/rdb/src/abs_shared_result_set.cpp index a67869347..5296411bf 100644 --- a/frameworks/native/rdb/src/abs_shared_result_set.cpp +++ b/frameworks/native/rdb/src/abs_shared_result_set.cpp @@ -13,14 +13,13 @@ * limitations under the License. */ -#define LOG_TAG "AbsSharedResultSet" - #include "abs_shared_result_set.h" +#include + #include #include #include -#include #include #include @@ -32,6 +31,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + AbsSharedResultSet::AbsSharedResultSet(std::string name) { AppDataFwk::SharedBlock::Create(name, DEFAULT_BLOCK_SIZE, sharedBlock_); diff --git a/frameworks/native/rdb/src/rdb_helper.cpp b/frameworks/native/rdb/src/rdb_helper.cpp index 6f6674f27..fc9d8687c 100644 --- a/frameworks/native/rdb/src/rdb_helper.cpp +++ b/frameworks/native/rdb/src/rdb_helper.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbHelper" - #include "rdb_helper.h" #include "logger.h" @@ -33,6 +31,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + std::shared_ptr RdbHelper::GetRdbStore( const RdbStoreConfig &config, int version, RdbOpenCallback &openCallback, int &errCode) { diff --git a/frameworks/native/rdb/src/rdb_manager_impl.cpp b/frameworks/native/rdb/src/rdb_manager_impl.cpp index bc4df7a6d..4fa6bf493 100644 --- a/frameworks/native/rdb/src/rdb_manager_impl.cpp +++ b/frameworks/native/rdb/src/rdb_manager_impl.cpp @@ -13,38 +13,38 @@ * limitations under the License. */ -#define LOG_TAG "RdbManagerImpl" - #include "rdb_manager_impl.h" #include -#include "iservice_registry.h" + #include "ipc_skeleton.h" +#include "irdb_service.h" +#include "iservice_registry.h" +#include "itypes_util.h" +#include "logger.h" +#include "rdb_errno.h" +#include "rdb_service_proxy.h" #include "system_ability_definition.h" -#include "log_print.h" -#include "irdb_service.h" -#include "itypes_util.h" -#include "rdb_service_proxy.h" -#include "rdb_errno.h" - namespace OHOS::DistributedRdb { +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; + std::shared_ptr RdbManagerImpl::GetDistributedDataManager() { auto manager = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (manager == nullptr) { - ZLOGE("get system ability manager failed"); + LOG_ERROR("get system ability manager failed"); return nullptr; } auto remoteObject = manager->CheckSystemAbility(DISTRIBUTED_KV_DATA_SERVICE_ABILITY_ID); if (remoteObject == nullptr) { - ZLOGE("get distributed data manager failed"); + LOG_ERROR("get distributed data manager failed"); return nullptr; } sptr rdbStoreDataServiceProxy = new(std::nothrow) RdbStoreDataServiceProxy(remoteObject); if (rdbStoreDataServiceProxy == nullptr) { - ZLOGE("new RdbStoreDataServiceProxy failed"); + LOG_ERROR("new RdbStoreDataServiceProxy failed"); return nullptr; } return std::shared_ptr(rdbStoreDataServiceProxy.GetRefPtr(), @@ -57,21 +57,21 @@ static void LinkToDeath(const sptr& remote) sptr deathRecipient = new(std::nothrow) RdbManagerImpl::ServiceDeathRecipient(&manager); if (deathRecipient == nullptr) { - ZLOGE("new ServiceDeathRecipient failed"); + LOG_ERROR("new ServiceDeathRecipient failed"); } if (!remote->AddDeathRecipient(deathRecipient)) { - ZLOGE("add death recipient failed"); + LOG_ERROR("add death recipient failed"); } } RdbManagerImpl::RdbManagerImpl() { - ZLOGI("construct"); + LOG_INFO("construct"); } RdbManagerImpl::~RdbManagerImpl() { - ZLOGI("destroy"); + LOG_INFO("destroy"); } RdbManagerImpl& RdbManagerImpl::GetInstance() @@ -91,13 +91,13 @@ int RdbManagerImpl::GetRdbService(const RdbSyncerParam ¶m, std::shared_ptrGetFeatureInterface(DistributedRdb::RdbService::SERVICE_NAME); if (remote == nullptr) { - ZLOGE("get rdb service failed"); + LOG_ERROR("get rdb service failed"); return E_NOT_SUPPORTED; } sptr serviceProxy = nullptr; @@ -113,7 +113,7 @@ int RdbManagerImpl::GetRdbService(const RdbSyncerParam ¶m, std::shared_ptrInitNotifier(param) != RDB_OK) { - ZLOGE("init notifier failed"); + LOG_ERROR("init notifier failed"); return E_ERROR; } sptr serviceBase = serviceProxy; @@ -129,7 +129,7 @@ int RdbManagerImpl::GetRdbService(const RdbSyncerParam ¶m, std::shared_ptr &impl) : IRemoteProxy(impl) { - ZLOGI("init data service proxy."); + LOG_INFO("init data service proxy."); } sptr RdbStoreDataServiceProxy::GetFeatureInterface(const std::string &name) { - ZLOGI("%s", name.c_str()); + LOG_INFO("%s", name.c_str()); MessageParcel data; if (!data.WriteInterfaceToken(RdbStoreDataServiceProxy::GetDescriptor())) { - ZLOGE("write descriptor failed"); + LOG_ERROR("write descriptor failed"); return nullptr; } if (!ITypesUtil::Marshal(data, name)) { - ZLOGE("write descriptor failed"); + LOG_ERROR("write descriptor failed"); return nullptr; } @@ -184,13 +184,13 @@ sptr RdbStoreDataServiceProxy::GetFeatureInterface(const std::str MessageOption mo { MessageOption::TF_SYNC }; int32_t error = Remote()->SendRequest(GET_FEATURE_INTERFACE, data, reply, mo); if (error != 0) { - ZLOGE("SendRequest returned %{public}d", error); + LOG_ERROR("SendRequest returned %{public}d", error); return nullptr; } sptr remoteObject; if (!ITypesUtil::Unmarshal(reply, remoteObject)) { - ZLOGE("remote object is nullptr"); + LOG_ERROR("remote object is nullptr"); return nullptr; } return remoteObject; diff --git a/frameworks/native/rdb/src/rdb_notifier_stub.cpp b/frameworks/native/rdb/src/rdb_notifier_stub.cpp index 08112ac8f..e28f57518 100644 --- a/frameworks/native/rdb/src/rdb_notifier_stub.cpp +++ b/frameworks/native/rdb/src/rdb_notifier_stub.cpp @@ -12,21 +12,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "RdbNotifierStub" + #include "rdb_notifier_stub.h" + #include + #include "itypes_util.h" -#include "log_print.h" +#include "logger.h" + namespace OHOS::DistributedRdb { +using namespace OHOS::Rdb; + RdbNotifierStub::RdbNotifierStub(const SyncCompleteHandler &completeNotifier, const DataChangeHandler &changeNotifier) : IRemoteStub(), completeNotifier_(completeNotifier), changeNotifier_(changeNotifier) { - ZLOGI("construct"); + LOG_INFO("construct"); } RdbNotifierStub::~RdbNotifierStub() noexcept { - ZLOGI("destroy"); + LOG_INFO("destroy"); } bool RdbNotifierStub::CheckInterfaceToken(MessageParcel& data) @@ -34,7 +39,7 @@ bool RdbNotifierStub::CheckInterfaceToken(MessageParcel& data) auto localDescriptor = GetDescriptor(); auto remoteDescriptor = data.ReadInterfaceToken(); if (remoteDescriptor != localDescriptor) { - ZLOGE("interface token is not equal"); + LOG_ERROR("interface token is not equal"); return false; } return true; @@ -43,7 +48,7 @@ bool RdbNotifierStub::CheckInterfaceToken(MessageParcel& data) int RdbNotifierStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - ZLOGD("code:%{public}u, callingPid:%{public}d", code, IPCSkeleton::GetCallingPid()); + LOG_DEBUG("code:%{public}u, callingPid:%{public}d", code, IPCSkeleton::GetCallingPid()); if (!CheckInterfaceToken(data)) { return RDB_ERROR; } @@ -59,12 +64,12 @@ int32_t RdbNotifierStub::OnCompleteInner(MessageParcel &data, MessageParcel &rep { uint32_t seqNum; if (!data.ReadUint32(seqNum)) { - ZLOGI("read seq num failed"); + LOG_INFO("read seq num failed"); return RDB_ERROR; } SyncResult result; if (!ITypesUtil::Unmarshal(data, result)) { - ZLOGE("read sync result failed"); + LOG_ERROR("read sync result failed"); return RDB_ERROR; } return OnComplete(seqNum, result); @@ -82,12 +87,12 @@ int32_t RdbNotifierStub::OnChangeInner(MessageParcel &data, MessageParcel &reply { std::string storeName; if (!data.ReadString(storeName)) { - ZLOGE("read store name failed"); + LOG_ERROR("read store name failed"); return RDB_ERROR; } std::vector devices; if (!data.ReadStringVector(&devices)) { - ZLOGE("read devices failed"); + LOG_ERROR("read devices failed"); return RDB_ERROR; } return OnChange(storeName, devices); diff --git a/frameworks/native/rdb/src/rdb_predicates.cpp b/frameworks/native/rdb/src/rdb_predicates.cpp index 30a7f52df..dd36cfee9 100644 --- a/frameworks/native/rdb/src/rdb_predicates.cpp +++ b/frameworks/native/rdb/src/rdb_predicates.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbPredicates" - #include "rdb_predicates.h" #include "logger.h" @@ -22,6 +20,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + RdbPredicates::RdbPredicates(std::string tableName) : AbsRdbPredicates(tableName) { InitialParam(); diff --git a/frameworks/native/rdb/src/rdb_security_manager.cpp b/frameworks/native/rdb/src/rdb_security_manager.cpp index c42eadf57..58d9cc59a 100644 --- a/frameworks/native/rdb/src/rdb_security_manager.cpp +++ b/frameworks/native/rdb/src/rdb_security_manager.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbSecurityManager" - #include "rdb_security_manager.h" #include @@ -39,6 +37,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + RdbPassword::RdbPassword() = default; RdbPassword::~RdbPassword() diff --git a/frameworks/native/rdb/src/rdb_service_proxy.cpp b/frameworks/native/rdb/src/rdb_service_proxy.cpp index 93baa425b..294e8c0fe 100644 --- a/frameworks/native/rdb/src/rdb_service_proxy.cpp +++ b/frameworks/native/rdb/src/rdb_service_proxy.cpp @@ -13,13 +13,14 @@ * limitations under the License. */ -#define LOG_TAG "RdbServiceProxy" - #include "rdb_service_proxy.h" + #include "itypes_util.h" -#include "log_print.h" +#include "logger.h" namespace OHOS::DistributedRdb { +using namespace OHOS::Rdb; + #define IPC_SEND(code, reply, ...) \ ({ \ int32_t __status = RDB_OK; \ @@ -77,7 +78,7 @@ std::string RdbServiceProxy::ObtainDistributedTableName(const std::string &devic MessageParcel reply; int32_t status = IPC_SEND(RDB_SERVICE_CMD_OBTAIN_TABLE, reply, device, table); if (status != RDB_OK) { - ZLOGE("status:%{public}d, device:%{public}.6s, table:%{public}s", status, device.c_str(), table.c_str()); + LOG_ERROR("status:%{public}d, device:%{public}.6s, table:%{public}s", status, device.c_str(), table.c_str()); return ""; } return reply.ReadString(); @@ -94,7 +95,7 @@ int32_t RdbServiceProxy::InitNotifier(const RdbSyncerParam ¶m) } ); if (notifier_ == nullptr) { - ZLOGE("create notifier failed"); + LOG_ERROR("create notifier failed"); return RDB_ERROR; } @@ -103,7 +104,7 @@ int32_t RdbServiceProxy::InitNotifier(const RdbSyncerParam ¶m) return RDB_ERROR; } - ZLOGI("success"); + LOG_INFO("success"); return RDB_OK; } @@ -112,7 +113,7 @@ int32_t RdbServiceProxy::InitNotifier(const RdbSyncerParam ¶m, const sptr= SUBSCRIBE_MODE_MAX) { - ZLOGE("subscribe mode invalid"); + LOG_ERROR("subscribe mode invalid"); return RDB_ERROR; } if (DoSubscribe(param, option) != RDB_OK) { - ZLOGI("communicate to server failed"); + LOG_INFO("communicate to server failed"); return RDB_ERROR; } auto name = RemoveSuffix(param.storeName_); @@ -234,7 +235,7 @@ int32_t RdbServiceProxy::Subscribe(const RdbSyncerParam ¶m, const SubscribeO name, [observer] (const auto& key, ObserverMapValue& value) { for (const auto& element : value.first) { if (element == observer) { - ZLOGE("duplicate observer"); + LOG_ERROR("duplicate observer"); return true; } } @@ -249,7 +250,7 @@ int32_t RdbServiceProxy::DoSubscribe(const RdbSyncerParam ¶m, const Subscrib MessageParcel reply; int32_t status = IPC_SEND(RDB_SERVICE_CMD_SUBSCRIBE, reply, param, option); if (status != RDB_OK) { - ZLOGE("status:%{public}d, bundleName:%{public}s, storeName:%{public}s", + LOG_ERROR("status:%{public}d, bundleName:%{public}s, storeName:%{public}s", status, param.bundleName_.c_str(), param.storeName_.c_str()); } return status; @@ -262,9 +263,9 @@ int32_t RdbServiceProxy::UnSubscribe(const RdbSyncerParam ¶m, const Subscrib auto name = RemoveSuffix(param.storeName_); observers_.ComputeIfPresent( name, [observer](const auto& key, ObserverMapValue& value) { - ZLOGI("before remove size=%{public}d", static_cast(value.first.size())); + LOG_INFO("before remove size=%{public}d", static_cast(value.first.size())); value.first.remove(observer); - ZLOGI("after remove size=%{public}d", static_cast(value.first.size())); + LOG_INFO("after remove size=%{public}d", static_cast(value.first.size())); return !(value.first.empty()); }); return RDB_OK; @@ -275,7 +276,7 @@ int32_t RdbServiceProxy::DoUnSubscribe(const RdbSyncerParam ¶m) MessageParcel reply; int32_t status = IPC_SEND(RDB_SERVICE_CMD_UNSUBSCRIBE, reply, param); if (status != RDB_OK) { - ZLOGE("status:%{public}d, bundleName:%{public}s, storeName:%{public}s", + LOG_ERROR("status:%{public}d, bundleName:%{public}s, storeName:%{public}s", status, param.bundleName_.c_str(), param.storeName_.c_str()); } return status; @@ -287,14 +288,14 @@ int32_t RdbServiceProxy::RemoteQuery(const RdbSyncerParam& param, const std::str MessageParcel reply; int32_t status = IPC_SEND(RDB_SERVICE_CMD_REMOTE_QUERY, reply, param, device, sql, selectionArgs); if (status != RDB_OK) { - ZLOGE("status:%{public}d, bundleName:%{public}s, storeName:%{public}s, device:%{public}.6s", + LOG_ERROR("status:%{public}d, bundleName:%{public}s, storeName:%{public}s, device:%{public}.6s", status, param.bundleName_.c_str(), param.storeName_.c_str(), device.c_str()); return status; } sptr remote = reply.ReadRemoteObject(); if (remote == nullptr) { - ZLOGE("read remote object is null"); + LOG_ERROR("read remote object is null"); return RDB_ERROR; } resultSet = remote; @@ -308,7 +309,7 @@ RdbServiceProxy::ObserverMap RdbServiceProxy::ExportObservers() void RdbServiceProxy::ImportObservers(ObserverMap &observers) { - ZLOGI("enter"); + LOG_INFO("enter"); SubscribeOption option {SubscribeMode::REMOTE}; observers.ForEach([this, &option](const std::string& key, const ObserverMapValue& value) { for (auto& observer : value.first) { @@ -323,7 +324,7 @@ int32_t RdbServiceProxy::GetSchema(const RdbSyncerParam ¶m) MessageParcel reply; int32_t status = IPC_SEND(RDB_SERVICE_CMD_GET_SCHEMA, reply, param); if (status != RDB_OK) { - ZLOGE("status:%{public}d, bundleName:%{public}s, storeName:%{public}s", status, param.bundleName_.c_str(), + LOG_ERROR("status:%{public}d, bundleName:%{public}s, storeName:%{public}s", status, param.bundleName_.c_str(), param.storeName_.c_str()); } return status; diff --git a/frameworks/native/rdb/src/rdb_store_config.cpp b/frameworks/native/rdb/src/rdb_store_config.cpp index 5238b304b..9960b1302 100644 --- a/frameworks/native/rdb/src/rdb_store_config.cpp +++ b/frameworks/native/rdb/src/rdb_store_config.cpp @@ -13,14 +13,14 @@ * limitations under the License. */ -#define LOG_TAG "RdbStoreConfig" - #include "rdb_store_config.h" #include "logger.h" #include "rdb_errno.h" namespace OHOS::NativeRdb { +using namespace OHOS::Rdb; + RdbStoreConfig::RdbStoreConfig(const std::string &name, StorageMode storageMode, bool isReadOnly, const std::vector &encryptKey, const std::string &journalMode, const std::string &syncMode, const std::string &databaseFileType, SecurityLevel securityLevel, bool isCreateNecessary, bool autoCheck, diff --git a/frameworks/native/rdb/src/rdb_store_impl.cpp b/frameworks/native/rdb/src/rdb_store_impl.cpp index 571013274..e3368474b 100644 --- a/frameworks/native/rdb/src/rdb_store_impl.cpp +++ b/frameworks/native/rdb/src/rdb_store_impl.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbStoreImpl" - #include "rdb_store_impl.h" #include @@ -53,6 +51,8 @@ #endif namespace OHOS::NativeRdb { +using namespace OHOS::Rdb; + std::shared_ptr RdbStoreImpl::Open(const RdbStoreConfig &config, int &errCode) { std::shared_ptr rdbStore = std::make_shared(config); @@ -120,6 +120,7 @@ RdbStoreImpl::RdbStoreImpl(const RdbStoreConfig &config) RdbStoreImpl::~RdbStoreImpl() { + LOG_INFO("destroy."); delete connectionPool; } #ifdef WINDOWS_PLATFORM @@ -480,6 +481,7 @@ int RdbStoreImpl::ExecuteSql(const std::string &sql, const std::vectorReOpenAvailableReadConnections(); } return errCode; diff --git a/frameworks/native/rdb/src/rdb_store_manager.cpp b/frameworks/native/rdb/src/rdb_store_manager.cpp index fe55ffb11..9f1343daa 100644 --- a/frameworks/native/rdb/src/rdb_store_manager.cpp +++ b/frameworks/native/rdb/src/rdb_store_manager.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbStoreManager" - #include "rdb_store_manager.h" #include @@ -33,6 +31,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + RdbStoreNode::RdbStoreNode(const std::shared_ptr &rdbStore) : rdbStore_(rdbStore), taskId_(TaskExecutor::INVALID_TASK_ID) { @@ -79,6 +79,7 @@ std::shared_ptr RdbStoreManager::GetRdbStore(const RdbStoreConfig &con pool_ = TaskExecutor::GetInstance().GetExecutor(); } if (pool_ != nullptr) { + LOG_INFO("config changed, taskId_: %{public}" PRIu64 "", storeCache_[path]->taskId_); pool_->Remove(storeCache_[path]->taskId_); } storeCache_.erase(path); @@ -139,6 +140,7 @@ void RdbStoreManager::Remove(const std::string &path) return; } if (pool_ != nullptr) { + LOG_INFO("remove taskId_: %{public}" PRIu64 "", it->second->taskId_); pool_->Remove(it->second->taskId_); } storeCache_.erase(it); diff --git a/frameworks/native/rdb/src/result_set_proxy.cpp b/frameworks/native/rdb/src/result_set_proxy.cpp index 639e65800..c9e27c1ff 100644 --- a/frameworks/native/rdb/src/result_set_proxy.cpp +++ b/frameworks/native/rdb/src/result_set_proxy.cpp @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#define LOG_TAG "ResultSetProxy" + #include "result_set_proxy.h" #include "logger.h" @@ -20,6 +20,8 @@ #include "rdb_errno.h" namespace OHOS::NativeRdb { +using namespace OHOS::Rdb; + ResultSetProxy::ResultSetProxy(const sptr &impl) : IRemoteProxy(impl) { LOG_INFO("Init result set proxy."); diff --git a/frameworks/native/rdb/src/security_policy.cpp b/frameworks/native/rdb/src/security_policy.cpp index d57781634..e59e00b3c 100644 --- a/frameworks/native/rdb/src/security_policy.cpp +++ b/frameworks/native/rdb/src/security_policy.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SecurityPolicy" - #include "security_policy.h" #include "logger.h" @@ -23,6 +21,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + int SecurityPolicy::SetFileSecurityLevel(const std::string &filePath, const std::string &securityLevel) { bool result = DistributedFS::ModuleSecurityLabel::SecurityLabel::SetSecurityLabel(filePath, securityLevel); diff --git a/frameworks/native/rdb/src/share_block.cpp b/frameworks/native/rdb/src/share_block.cpp index 9ee38df64..9cdbc5bb9 100644 --- a/frameworks/native/rdb/src/share_block.cpp +++ b/frameworks/native/rdb/src/share_block.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SharedBlock" - #include "share_block.h" #include @@ -24,6 +22,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + const int ERROR_STATUS = -1; const unsigned int SLEEP_TIME = 1000; // move to the highest 32 bits of 64 bits number diff --git a/frameworks/native/rdb/src/shared_block_serializer_info.cpp b/frameworks/native/rdb/src/shared_block_serializer_info.cpp index d04e03e1c..7517e2ff4 100644 --- a/frameworks/native/rdb/src/shared_block_serializer_info.cpp +++ b/frameworks/native/rdb/src/shared_block_serializer_info.cpp @@ -13,14 +13,14 @@ * limitations under the License. */ -#define LOG_TAG "SharedBlockSerializerInfo" - #include "shared_block_serializer_info.h" #include "logger.h" namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + SharedBlockSerializerInfo::SharedBlockSerializerInfo(AppDataFwk::SharedBlock *sharedBlock, int numColumns, int startPos) :sharedBlock_(sharedBlock), anumColumns(numColumns), atotalRows(0), astartPos(startPos), raddedRows(0), risFull(false) diff --git a/frameworks/native/rdb/src/sqlite_connection.cpp b/frameworks/native/rdb/src/sqlite_connection.cpp index 5b070f4e7..fda2fe9b7 100644 --- a/frameworks/native/rdb/src/sqlite_connection.cpp +++ b/frameworks/native/rdb/src/sqlite_connection.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SqliteConnection" - #include "sqlite_connection.h" #include @@ -44,6 +42,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + #if !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM) // error status const int ERROR_STATUS = -1; diff --git a/frameworks/native/rdb/src/sqlite_connection_pool.cpp b/frameworks/native/rdb/src/sqlite_connection_pool.cpp index e4084a6f2..4fab1af73 100644 --- a/frameworks/native/rdb/src/sqlite_connection_pool.cpp +++ b/frameworks/native/rdb/src/sqlite_connection_pool.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SqliteConnectionPool" - #include "sqlite_connection_pool.h" #include @@ -33,6 +31,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + constexpr std::chrono::seconds WAIT_CONNECT_TIMEOUT(2); SqliteConnectionPool *SqliteConnectionPool::Create(const RdbStoreConfig &storeConfig, int &errCode) @@ -294,6 +294,7 @@ int SqliteConnectionPool::ChangeDbFileForRestore(const std::string newPath, cons return E_ERROR; } + LOG_ERROR("restore."); CloseAllConnections(); std::string currentPath = config.GetPath(); diff --git a/frameworks/native/rdb/src/sqlite_database_utils.cpp b/frameworks/native/rdb/src/sqlite_database_utils.cpp index 3cdfb9823..2fcaff90e 100644 --- a/frameworks/native/rdb/src/sqlite_database_utils.cpp +++ b/frameworks/native/rdb/src/sqlite_database_utils.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SqliteDatabaseUtils" - #include "sqlite_database_utils.h" #include @@ -43,6 +41,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + std::map SqliteDatabaseUtils::g_statementType = SqliteDatabaseUtils::MapInit(); std::mutex SqliteDatabaseUtils::g_locker; // Set the file access permissions is 777 diff --git a/frameworks/native/rdb/src/sqlite_global_config.cpp b/frameworks/native/rdb/src/sqlite_global_config.cpp index a2ee7f283..f31e5b006 100644 --- a/frameworks/native/rdb/src/sqlite_global_config.cpp +++ b/frameworks/native/rdb/src/sqlite_global_config.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SqliteGlobalConfig" - #include "sqlite_global_config.h" #include @@ -25,6 +23,7 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; void SqliteGlobalConfig::InitSqliteGlobalConfig() { diff --git a/frameworks/native/rdb/src/sqlite_shared_result_set.cpp b/frameworks/native/rdb/src/sqlite_shared_result_set.cpp index 82c99b6c9..5da5840fd 100644 --- a/frameworks/native/rdb/src/sqlite_shared_result_set.cpp +++ b/frameworks/native/rdb/src/sqlite_shared_result_set.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SqliteSharedResultSet" - #include "sqlite_shared_result_set.h" #include @@ -28,6 +26,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + SqliteSharedResultSet::SqliteSharedResultSet(SqliteConnectionPool* connectionPool, std::string path, std::string sql, const std::vector &bindArgs) : AbsSharedResultSet(path), resultSetBlockCapacity(0), isOnlyFillResultSetBlock(false), diff --git a/frameworks/native/rdb/src/sqlite_sql_builder.cpp b/frameworks/native/rdb/src/sqlite_sql_builder.cpp index a8ab43c17..3f2b1df20 100644 --- a/frameworks/native/rdb/src/sqlite_sql_builder.cpp +++ b/frameworks/native/rdb/src/sqlite_sql_builder.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SqliteSqlBuilder" - #include "sqlite_sql_builder.h" #include @@ -27,6 +25,7 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; const std::string SqliteSqlBuilder::patternWords_ = "['\"`]?(\\w+)['\"`]?|['\"`]([^`\"']+)['\"`]"; const std::string SqliteSqlBuilder::patternTableColumn_ = "(" + patternWords_ + ")[.](" + patternWords_ + "|\\*)"; diff --git a/frameworks/native/rdb/src/sqlite_statement.cpp b/frameworks/native/rdb/src/sqlite_statement.cpp index 57ec7652a..4d0db3379 100644 --- a/frameworks/native/rdb/src/sqlite_statement.cpp +++ b/frameworks/native/rdb/src/sqlite_statement.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SqliteStatement" - #include "sqlite_statement.h" #include @@ -27,6 +25,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + // Setting Data Precision const int SET_DATA_PRECISION = 15; SqliteStatement::SqliteStatement() : sql(""), stmtHandle(nullptr), readOnly(false), columnCount(0), numParameters(0) diff --git a/frameworks/native/rdb/src/sqlite_utils.cpp b/frameworks/native/rdb/src/sqlite_utils.cpp index 43011e751..c08c4b900 100644 --- a/frameworks/native/rdb/src/sqlite_utils.cpp +++ b/frameworks/native/rdb/src/sqlite_utils.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "SqliteUtils" - #include "sqlite_utils.h" #include @@ -35,6 +33,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + const int SqliteUtils::STATEMENT_SELECT = 1; const int SqliteUtils::STATEMENT_UPDATE = 2; const int SqliteUtils::STATEMENT_ATTACH = 3; diff --git a/frameworks/native/rdb/src/step_result_set.cpp b/frameworks/native/rdb/src/step_result_set.cpp index b2064f4cf..7d6f34b1a 100644 --- a/frameworks/native/rdb/src/step_result_set.cpp +++ b/frameworks/native/rdb/src/step_result_set.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "StepResultSet" - #include "step_result_set.h" #include @@ -29,6 +27,8 @@ namespace OHOS { namespace NativeRdb { +using namespace OHOS::Rdb; + StepResultSet::StepResultSet(std::shared_ptr rdb, const std::string &sql, const std::vector &selectionArgs) : rdb(rdb), sql(sql), selectionArgs(selectionArgs), isAfterLast(false), rowCount(INIT_POS), diff --git a/frameworks/native/rdb_bms_adaptor/src/data_share_profile_info.cpp b/frameworks/native/rdb_bms_adaptor/src/data_share_profile_info.cpp index c0a33c219..e74ab2407 100644 --- a/frameworks/native/rdb_bms_adaptor/src/data_share_profile_info.cpp +++ b/frameworks/native/rdb_bms_adaptor/src/data_share_profile_info.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "DataShareProfileInfo" - #include "data_share_profile_info.h" #include @@ -27,6 +25,8 @@ #include "bundle_info.h" #include "hilog/log.h" namespace OHOS::RdbBMSAdapter { +using namespace OHOS::Rdb; + constexpr const char *DATA_SHARE_PROFILE_META = "ohos.extension.dataShare"; constexpr const char *PROFILE_FILE_PREFIX = "$profile:"; const size_t PROFILE_PREFIX_LEN = strlen(PROFILE_FILE_PREFIX); diff --git a/frameworks/native/rdb_data_share_adapter/src/rdb_result_set_bridge.cpp b/frameworks/native/rdb_data_share_adapter/src/rdb_result_set_bridge.cpp index afd97e01e..f10436a75 100644 --- a/frameworks/native/rdb_data_share_adapter/src/rdb_result_set_bridge.cpp +++ b/frameworks/native/rdb_data_share_adapter/src/rdb_result_set_bridge.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbResultSetBridge" - #include "rdb_result_set_bridge.h" #include "logger.h" @@ -24,7 +22,9 @@ namespace OHOS { namespace RdbDataShareAdapter { +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; + RdbResultSetBridge::RdbResultSetBridge(std::shared_ptr resultSet) : rdbResultSet_(resultSet) { } diff --git a/frameworks/native/rdb_data_share_adapter/src/rdb_utils.cpp b/frameworks/native/rdb_data_share_adapter/src/rdb_utils.cpp index 114f3b022..ec27e2771 100644 --- a/frameworks/native/rdb_data_share_adapter/src/rdb_utils.cpp +++ b/frameworks/native/rdb_data_share_adapter/src/rdb_utils.cpp @@ -13,12 +13,12 @@ * limitations under the License. */ -#define LOG_TAG "RdbUtils" - #include "rdb_utils.h" #include "logger.h" #include "raw_data_parser.h" + +using namespace OHOS::Rdb; using namespace OHOS::RdbDataShareAdapter; using namespace OHOS::DataShare; using namespace OHOS::NativeRdb; diff --git a/frameworks/native/rdb_device_manager_adapter/src/rdb_device_manager_adapter.cpp b/frameworks/native/rdb_device_manager_adapter/src/rdb_device_manager_adapter.cpp index 5ec5f2d96..87731eb2b 100644 --- a/frameworks/native/rdb_device_manager_adapter/src/rdb_device_manager_adapter.cpp +++ b/frameworks/native/rdb_device_manager_adapter/src/rdb_device_manager_adapter.cpp @@ -13,12 +13,10 @@ * limitations under the License. */ -#define LOG_TAG "RdbDeviceManagerAdaptor" +#include "rdb_device_manager_adapter.h" #include -#include "rdb_device_manager_adapter.h" - namespace OHOS { namespace DeviceManagerAdaptor { using namespace OHOS::DistributedHardware; diff --git a/interfaces/inner_api/appdatafwk/BUILD.gn b/interfaces/inner_api/appdatafwk/BUILD.gn index 05fb8856f..e29929834 100644 --- a/interfaces/inner_api/appdatafwk/BUILD.gn +++ b/interfaces/inner_api/appdatafwk/BUILD.gn @@ -37,6 +37,7 @@ ohos_shared_library("native_appdatafwk") { configs = [ ":appdatafwk_config" ] subsystem_name = "distributeddatamgr" + innerapi_tags = [ "platformsdk_indirect" ] part_name = "relational_store" public_deps = [ "${ipc_path}/ipc_single:ipc_single" ] diff --git a/interfaces/inner_api/rdb/include/transaction_observer.h b/interfaces/inner_api/rdb/include/transaction_observer.h deleted file mode 100644 index 0f3d7a73d..000000000 --- a/interfaces/inner_api/rdb/include/transaction_observer.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2021 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. - */ - - -#ifndef APPDATAMGR_TRANSACTION_OBSERVER_H -#define APPDATAMGR_TRANSACTION_OBSERVER_H - -#include "rdb_visibility.h" - -namespace OHOS { -namespace NativeRdb { -/** - * The TransactionObserver class of RDB. - */ -class API_EXPORT TransactionObserver { -public: - /** - * @brief Destructor. - */ - API_EXPORT virtual ~TransactionObserver() {} - - /** - * @brief Begin transaction. - */ - API_EXPORT virtual void OnBegin() const; - - /** - * @brief Commit transaction. - */ - API_EXPORT virtual void OnCommit() const; - - /** - * @brief Rollback transaction. - */ - API_EXPORT virtual void OnRollback() const; -}; -} // namespace NativeRdb -} // namespace OHOS - -#endif \ No newline at end of file diff --git a/interfaces/ndk/src/relational_cursor.cpp b/interfaces/ndk/src/relational_cursor.cpp index 8be9d738c..29ce9dc9f 100644 --- a/interfaces/ndk/src/relational_cursor.cpp +++ b/interfaces/ndk/src/relational_cursor.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "NdkRelationalCursor" - #include #include #include diff --git a/interfaces/ndk/src/relational_predicates.cpp b/interfaces/ndk/src/relational_predicates.cpp index 01b07e054..12bf3aa54 100644 --- a/interfaces/ndk/src/relational_predicates.cpp +++ b/interfaces/ndk/src/relational_predicates.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "NdkRelationalPredicates" - #include "logger.h" #include "oh_predicates.h" #include "relational_error_code.h" diff --git a/interfaces/ndk/src/relational_store.cpp b/interfaces/ndk/src/relational_store.cpp index bad81a7d4..47ce1ab07 100644 --- a/interfaces/ndk/src/relational_store.cpp +++ b/interfaces/ndk/src/relational_store.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "NdkRelationalStore" - #include "relational_store.h" #include "logger.h" diff --git a/interfaces/ndk/src/relational_value_object.cpp b/interfaces/ndk/src/relational_value_object.cpp index 8f142c6b7..c2286e418 100644 --- a/interfaces/ndk/src/relational_value_object.cpp +++ b/interfaces/ndk/src/relational_value_object.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "NdkRelationalValueObject" - #include "logger.h" #include "oh_value_object.h" #include "relational_error_code.h" diff --git a/interfaces/ndk/src/relational_values_bucket.cpp b/interfaces/ndk/src/relational_values_bucket.cpp index e99e21748..5ac627b63 100644 --- a/interfaces/ndk/src/relational_values_bucket.cpp +++ b/interfaces/ndk/src/relational_values_bucket.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "NdkRelationalValueBucket" - #include #include "logger.h" diff --git a/test/native/rdb/unittest/rdb_delete_test.cpp b/test/native/rdb/unittest/rdb_delete_test.cpp index bf08d4d14..64fda51e8 100644 --- a/test/native/rdb/unittest/rdb_delete_test.cpp +++ b/test/native/rdb/unittest/rdb_delete_test.cpp @@ -23,7 +23,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbDeleteTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_execute_test.cpp b/test/native/rdb/unittest/rdb_execute_test.cpp index 7f1edcfad..808e48302 100644 --- a/test/native/rdb/unittest/rdb_execute_test.cpp +++ b/test/native/rdb/unittest/rdb_execute_test.cpp @@ -23,7 +23,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbExecuteTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_insert_test.cpp b/test/native/rdb/unittest/rdb_insert_test.cpp index f153b6deb..5468e491c 100644 --- a/test/native/rdb/unittest/rdb_insert_test.cpp +++ b/test/native/rdb/unittest/rdb_insert_test.cpp @@ -24,7 +24,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbStoreInsertTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_open_callback_test.cpp b/test/native/rdb/unittest/rdb_open_callback_test.cpp index 75dccbef8..00c565841 100644 --- a/test/native/rdb/unittest/rdb_open_callback_test.cpp +++ b/test/native/rdb/unittest/rdb_open_callback_test.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbOpenCallbackTest" - #include "rdb_open_callback.h" #include @@ -27,7 +25,7 @@ #include "rdb_helper.h" using namespace testing::ext; -using namespace OHOS; +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; class RdbOpenCallbackTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_sqlite_shared_result_set_test.cpp b/test/native/rdb/unittest/rdb_sqlite_shared_result_set_test.cpp index 8bd1ab5ba..62c9cf155 100644 --- a/test/native/rdb/unittest/rdb_sqlite_shared_result_set_test.cpp +++ b/test/native/rdb/unittest/rdb_sqlite_shared_result_set_test.cpp @@ -25,7 +25,6 @@ #include "sqlite_shared_result_set.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbSqliteSharedResultSetTest : public testing::Test { public: diff --git a/test/native/rdb/unittest/rdb_step_result_get_row_test.cpp b/test/native/rdb/unittest/rdb_step_result_get_row_test.cpp index 30b903094..e2235cf35 100644 --- a/test/native/rdb/unittest/rdb_step_result_get_row_test.cpp +++ b/test/native/rdb/unittest/rdb_step_result_get_row_test.cpp @@ -23,7 +23,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbStepResultSetGetRowTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_step_result_set_test.cpp b/test/native/rdb/unittest/rdb_step_result_set_test.cpp index a4ade4e96..e6a9047f0 100644 --- a/test/native/rdb/unittest/rdb_step_result_set_test.cpp +++ b/test/native/rdb/unittest/rdb_step_result_set_test.cpp @@ -24,7 +24,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbStepResultSetTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_store_concurrent_test.cpp b/test/native/rdb/unittest/rdb_store_concurrent_test.cpp index f9e053e24..05e12278b 100644 --- a/test/native/rdb/unittest/rdb_store_concurrent_test.cpp +++ b/test/native/rdb/unittest/rdb_store_concurrent_test.cpp @@ -24,7 +24,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbConcurrentTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_store_config_test.cpp b/test/native/rdb/unittest/rdb_store_config_test.cpp index 088f0f088..95deea3f0 100644 --- a/test/native/rdb/unittest/rdb_store_config_test.cpp +++ b/test/native/rdb/unittest/rdb_store_config_test.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbStoreConfigTest" - #include #include @@ -27,7 +25,7 @@ #include "unistd.h" using namespace testing::ext; -using namespace OHOS; +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; class RdbStoreConfigTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_store_interface_test.cpp b/test/native/rdb/unittest/rdb_store_interface_test.cpp index 033a34634..cb0b3d0bd 100644 --- a/test/native/rdb/unittest/rdb_store_interface_test.cpp +++ b/test/native/rdb/unittest/rdb_store_interface_test.cpp @@ -23,7 +23,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbStoreInterfaceTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_transaction_test.cpp b/test/native/rdb/unittest/rdb_transaction_test.cpp index cdc9f7767..09278dff5 100644 --- a/test/native/rdb/unittest/rdb_transaction_test.cpp +++ b/test/native/rdb/unittest/rdb_transaction_test.cpp @@ -24,7 +24,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbTransactionTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_update_test.cpp b/test/native/rdb/unittest/rdb_update_test.cpp index d5bb63fb4..62bdb009d 100644 --- a/test/native/rdb/unittest/rdb_update_test.cpp +++ b/test/native/rdb/unittest/rdb_update_test.cpp @@ -24,7 +24,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbStoreUpdateTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_upgrade_test.cpp b/test/native/rdb/unittest/rdb_upgrade_test.cpp index c31df8f35..a4fb1ab38 100644 --- a/test/native/rdb/unittest/rdb_upgrade_test.cpp +++ b/test/native/rdb/unittest/rdb_upgrade_test.cpp @@ -23,7 +23,6 @@ #include "rdb_open_callback.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbUpgradeTest : public testing::Test { diff --git a/test/native/rdb/unittest/rdb_value_bucket_test.cpp b/test/native/rdb/unittest/rdb_value_bucket_test.cpp index 7bf8e0811..a1facb835 100644 --- a/test/native/rdb/unittest/rdb_value_bucket_test.cpp +++ b/test/native/rdb/unittest/rdb_value_bucket_test.cpp @@ -24,6 +24,7 @@ #include "sqlite_global_config.h" #include "value_object.h" #include "values_bucket.h" + using namespace testing::ext; using namespace OHOS; using namespace OHOS::NativeRdb; diff --git a/test/native/rdb/unittest/rdb_wal_limit_test.cpp b/test/native/rdb/unittest/rdb_wal_limit_test.cpp index e6c82f2f1..9fc763f95 100644 --- a/test/native/rdb/unittest/rdb_wal_limit_test.cpp +++ b/test/native/rdb/unittest/rdb_wal_limit_test.cpp @@ -25,7 +25,6 @@ #include "sqlite_global_config.h" using namespace testing::ext; -using namespace OHOS; using namespace OHOS::NativeRdb; class RdbWalLimitTest : public testing::Test { diff --git a/test/native/rdb_data_share_adapter/unittest/rdb_data_share_adapter_test.cpp b/test/native/rdb_data_share_adapter/unittest/rdb_data_share_adapter_test.cpp index 881e2be61..27e1da7f5 100644 --- a/test/native/rdb_data_share_adapter/unittest/rdb_data_share_adapter_test.cpp +++ b/test/native/rdb_data_share_adapter/unittest/rdb_data_share_adapter_test.cpp @@ -13,8 +13,6 @@ * limitations under the License. */ -#define LOG_TAG "RdbDataShareAdapterTest" - #include #include @@ -26,7 +24,7 @@ #include "rdb_utils.h" using namespace testing::ext; -using namespace OHOS; +using namespace OHOS::Rdb; using namespace OHOS::NativeRdb; using namespace OHOS::DataShare; using namespace OHOS::RdbDataShareAdapter;