Merge branch 'master' of gitee.com:openharmony/distributeddatamgr_relational_store into master

Signed-off-by: LeiiYB <leiyanbo@huawei.com>
This commit is contained in:
LeiiYB 2023-06-05 11:23:54 +00:00 committed by leiiyb
commit c0755a665b
96 changed files with 299 additions and 384 deletions

View File

@ -109,7 +109,6 @@
"rdb_store_config.h",
"result_set.h",
"shared_result_set.h",
"transaction_observer.h",
"value_object.h",
"values_bucket.h"
],

View File

@ -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

View File

@ -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 {

View File

@ -15,12 +15,12 @@
#ifndef LDBPROJ_JS_ERROR_UTILS_H
#define LDBPROJ_JS_ERROR_UTILS_H
#include <optional>
#include <string>
#include "cloud_service.h"
#include "js_native_api.h"
#include "log_print.h"
#include "napi/native_common.h"
namespace OHOS {

View File

@ -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 <functional>
#include <memory>
#include <string>
#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<void(size_t argc, napi_value *argv)>;
using NapiAsyncExecute = std::function<void(void)>;
@ -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)

View File

@ -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");
}

View File

@ -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 <cstddef>
#include <memory>
#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 <cstddef>
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<JsConfig *>(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;
}

View File

@ -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)
{

View File

@ -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 <algorithm>
#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;
}

View File

@ -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<ContextBase> 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<ContextBase> 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<ContextBase> ctxt,
[](napi_env env, void *data) {
ASSERT_VOID(data != nullptr, "napi_async_execute_callback nullptr");
auto actx = reinterpret_cast<AsyncContext *>(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<ContextBase> ctxt,
[](napi_env env, napi_status status, void *data) {
ASSERT_VOID(data != nullptr, "napi_async_complete_callback nullptr");
auto actx = reinterpret_cast<AsyncContext *>(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);
}
}

View File

@ -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<AbilityRuntime::Context> stageContext)
{
databaseDir_ = stageContext->GetDatabaseDir();

View File

@ -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)) { \

View File

@ -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");
}

View File

@ -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;

View File

@ -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 {

View File

@ -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",
]

View File

@ -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;

View File

@ -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");
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -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;

View File

@ -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;

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "JsRdbStoreHelper"
#include "napi_rdb_store_helper.h"
#include <functional>
@ -34,6 +32,7 @@
#include "sqlite_database_utils.h"
#include "unistd.h"
using namespace OHOS::Rdb;
using namespace OHOS::NativeRdb;
using namespace OHOS::AppDataMgrJsKit;

View File

@ -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 {

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "JsResultSet"
#include "napi_result_set.h"
#include <functional>
@ -31,6 +29,7 @@
#include "string_ex.h"
#endif
using namespace OHOS::Rdb;
using namespace OHOS::NativeRdb;
using namespace OHOS::AppDataMgrJsKit;

View File

@ -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)
{

View File

@ -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;

View File

@ -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");
}

View File

@ -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 {

View File

@ -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)
{

View File

@ -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;

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "RdbStore"
#include "napi_rdb_store.h"
#include <cinttypes>
@ -36,6 +34,7 @@
using namespace OHOS::DataShare;
#endif
using namespace OHOS::Rdb;
using namespace OHOS::NativeRdb;
using namespace OHOS::AppDataMgrJsKit;

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "RdbStoreHelper"
#include "napi_rdb_store_helper.h"
#include <functional>
@ -34,6 +32,7 @@
#include "sqlite_database_utils.h"
#include "unistd.h"
using namespace OHOS::Rdb;
using namespace OHOS::NativeRdb;
using namespace OHOS::AppDataMgrJsKit;

View File

@ -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 {

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "RdbResultSet"
#include "napi_result_set.h"
#include <functional>
@ -29,6 +27,7 @@
#include "string_ex.h"
#endif
using namespace OHOS::Rdb;
using namespace OHOS::NativeRdb;
using namespace OHOS::AppDataMgrJsKit;

View File

@ -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)
{

View File

@ -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> ashmem, size_t size, bool readOnly)
: mName(name), ashmem_(ashmem), mSize(size), mReadOnly(readOnly), mHeader(nullptr)
{

View File

@ -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<CloudData::IKvStoreDataService> {
public:
explicit DataMgrService(const sptr<IRemoteObject> &impl);
@ -60,24 +61,24 @@ std::pair<int32_t, std::shared_ptr<CloudService>> 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<DataMgrService> 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<int32_t, std::shared_ptr<CloudService>> CloudManager::GetCloudService(
DataMgrService::DataMgrService(const sptr<IRemoteObject> &impl) : IRemoteProxy<CloudData::IKvStoreDataService>(impl)
{
ZLOGI("init proxy");
LOG_INFO("init proxy");
}
sptr<IRemoteObject> 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<IRemoteObject> 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<IRemoteObject> remoteObject;
if (!ITypesUtil::Unmarshal(reply, remoteObject)) {
ZLOGE("remote object is nullptr");
LOG_ERROR("remote object is nullptr");
return nullptr;
}
return remoteObject;

View File

@ -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<std
MessageParcel reply;
int32_t status = IPC_SEND(TRANS_ENABLE_CLOUD, reply, id, switches);
if (status != SUCCESS) {
ZLOGE("status:0x%{public}x id:%{public}.6s size:%{public}zu", status, id.c_str(), switches.size());
LOG_ERROR("status:0x%{public}x id:%{public}.6s size:%{public}zu", status, id.c_str(), switches.size());
}
return static_cast<Status>(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>(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>(status);
@ -87,7 +87,7 @@ int32_t CloudServiceProxy::Clean(const std::string &id, const std::map<std::stri
MessageParcel reply;
int32_t status = IPC_SEND(TRANS_CLEAN, reply, id, actions);
if (status != SUCCESS) {
ZLOGE("status:0x%{public}x id:%{public}.6s size:%{public}zu", status, id.c_str(), actions.size());
LOG_ERROR("status:0x%{public}x id:%{public}.6s size:%{public}zu", status, id.c_str(), actions.size());
}
return static_cast<Status>(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>(status);
}

View File

@ -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<std::shared_ptr<AbsSharedResultSet>(
MessageParcel &parcel)> ISharedResultSet::consumerCreator_ = ISharedResultSetProxy::CreateProxy;
BrokerDelegator<ISharedResultSetProxy> ISharedResultSetProxy::delegator_;

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "ISharedResultSetStub"
#include "ishared_result_set_stub.h"
#include <future>
@ -23,6 +21,8 @@
#include "rdb_errno.h"
namespace OHOS::NativeRdb {
using namespace OHOS::Rdb;
std::function<sptr<ISharedResultSet>(std::shared_ptr<AbsSharedResultSet>,
MessageParcel &)> ISharedResultSet::providerCreator_ = ISharedResultSetStub::CreateStub;
constexpr ISharedResultSetStub::Handler ISharedResultSetStub::handlers[ISharedResultSet::FUNC_BUTT];

View File

@ -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;

View File

@ -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<RdbStoreImpl> {

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "AbsPredicates"
#include "abs_predicates.h"
#include <algorithm>
@ -27,6 +25,8 @@
namespace OHOS {
namespace NativeRdb {
using namespace OHOS::Rdb;
AbsPredicates::AbsPredicates()
{
Initial();

View File

@ -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()) {

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "AbsResultSet"
#include "abs_result_set.h"
#include <algorithm>
@ -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));

View File

@ -13,14 +13,13 @@
* limitations under the License.
*/
#define LOG_TAG "AbsSharedResultSet"
#include "abs_shared_result_set.h"
#include <securec.h>
#include <algorithm>
#include <codecvt>
#include <iostream>
#include <securec.h>
#include <sstream>
#include <string>
@ -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_);

View File

@ -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<RdbStore> RdbHelper::GetRdbStore(
const RdbStoreConfig &config, int version, RdbOpenCallback &openCallback, int &errCode)
{

View File

@ -13,38 +13,38 @@
* limitations under the License.
*/
#define LOG_TAG "RdbManagerImpl"
#include "rdb_manager_impl.h"
#include <thread>
#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<RdbStoreDataServiceProxy> 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> 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>(rdbStoreDataServiceProxy.GetRefPtr(),
@ -57,21 +57,21 @@ static void LinkToDeath(const sptr<IRemoteObject>& remote)
sptr<RdbManagerImpl::ServiceDeathRecipient> 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 &param, std::shared_ptr<R
distributedDataMgr_ = GetDistributedDataManager();
}
if (distributedDataMgr_ == nullptr) {
ZLOGE("get distributed data manager failed");
LOG_ERROR("get distributed data manager failed");
return E_ERROR;
}
auto remote = distributedDataMgr_->GetFeatureInterface(DistributedRdb::RdbService::SERVICE_NAME);
if (remote == nullptr) {
ZLOGE("get rdb service failed");
LOG_ERROR("get rdb service failed");
return E_NOT_SUPPORTED;
}
sptr<DistributedRdb::RdbServiceProxy> serviceProxy = nullptr;
@ -113,7 +113,7 @@ int RdbManagerImpl::GetRdbService(const RdbSyncerParam &param, std::shared_ptr<R
return E_ERROR;
}
if (serviceProxy->InitNotifier(param) != RDB_OK) {
ZLOGE("init notifier failed");
LOG_ERROR("init notifier failed");
return E_ERROR;
}
sptr<IRdbService> serviceBase = serviceProxy;
@ -129,7 +129,7 @@ int RdbManagerImpl::GetRdbService(const RdbSyncerParam &param, std::shared_ptr<R
void RdbManagerImpl::OnRemoteDied()
{
ZLOGI("rdb service has dead!!");
LOG_INFO("rdb service has dead!!");
if (rdbService_ == nullptr) {
ResetServiceHandle();
return;
@ -163,20 +163,20 @@ void RdbManagerImpl::ResetServiceHandle()
RdbStoreDataServiceProxy::RdbStoreDataServiceProxy(const sptr<IRemoteObject> &impl)
: IRemoteProxy<DistributedRdb::IKvStoreDataService>(impl)
{
ZLOGI("init data service proxy.");
LOG_INFO("init data service proxy.");
}
sptr<IRemoteObject> 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<IRemoteObject> 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<IRemoteObject> remoteObject;
if (!ITypesUtil::Unmarshal(reply, remoteObject)) {
ZLOGE("remote object is nullptr");
LOG_ERROR("remote object is nullptr");
return nullptr;
}
return remoteObject;

View File

@ -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 <ipc_skeleton.h>
#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<RdbNotifierStubBroker>(), 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<std::string> devices;
if (!data.ReadStringVector(&devices)) {
ZLOGE("read devices failed");
LOG_ERROR("read devices failed");
return RDB_ERROR;
}
return OnChange(storeName, devices);

View File

@ -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();

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "RdbSecurityManager"
#include "rdb_security_manager.h"
#include <securec.h>
@ -39,6 +37,8 @@
namespace OHOS {
namespace NativeRdb {
using namespace OHOS::Rdb;
RdbPassword::RdbPassword() = default;
RdbPassword::~RdbPassword()

View File

@ -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 &param)
}
);
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 &param)
return RDB_ERROR;
}
ZLOGI("success");
LOG_INFO("success");
return RDB_OK;
}
@ -112,7 +113,7 @@ int32_t RdbServiceProxy::InitNotifier(const RdbSyncerParam &param, const sptr<IR
MessageParcel reply;
int32_t status = IPC_SEND(RDB_SERVICE_CMD_INIT_NOTIFIER, reply, param, notifier);
if (status != RDB_OK) {
ZLOGE("status:%{public}d, bundleName:%{public}s", status, param.bundleName_.c_str());
LOG_ERROR("status:%{public}d, bundleName:%{public}s", status, param.bundleName_.c_str());
}
return status;
}
@ -128,13 +129,13 @@ int32_t RdbServiceProxy::DoSync(const RdbSyncerParam& param, const SyncOption &o
MessageParcel reply;
int32_t status = IPC_SEND(RDB_SERVICE_CMD_SYNC, reply, param, option, predicates);
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;
}
if (!ITypesUtil::Unmarshal(reply, result)) {
ZLOGE("read result failed");
LOG_ERROR("read result failed");
return RDB_ERROR;
}
return RDB_OK;
@ -145,10 +146,10 @@ int32_t RdbServiceProxy::DoSync(const RdbSyncerParam& param, const SyncOption &o
{
SyncResult result;
if (DoSync(param, option, predicates, result) != RDB_OK) {
ZLOGI("failed");
LOG_INFO("failed");
return RDB_ERROR;
}
ZLOGI("success");
LOG_INFO("success");
if (callback != nullptr) {
callback(result);
@ -162,7 +163,7 @@ int32_t RdbServiceProxy::DoAsync(const RdbSyncerParam& param, uint32_t seqNum, c
MessageParcel reply;
int32_t status = IPC_SEND(RDB_SERVICE_CMD_ASYNC, reply, param, seqNum, option, predicates);
if (status != RDB_OK) {
ZLOGE("status:%{public}d, bundleName:%{public}s, storeName:%{public}s, seqNum:%{public}u",
LOG_ERROR("status:%{public}d, bundleName:%{public}s, storeName:%{public}s, seqNum:%{public}u",
status, param.bundleName_.c_str(), param.storeName_.c_str(), seqNum);
}
return status;
@ -173,18 +174,18 @@ int32_t RdbServiceProxy::DoAsync(const RdbSyncerParam& param, const SyncOption &
{
uint32_t num = GetSeqNum();
if (!syncCallbacks_.Insert(num, callback)) {
ZLOGI("insert callback failed");
LOG_INFO("insert callback failed");
return RDB_ERROR;
}
ZLOGI("num=%{public}u", num);
LOG_INFO("num=%{public}u", num);
if (DoAsync(param, num, option, predicates) != RDB_OK) {
ZLOGE("failed");
LOG_ERROR("failed");
syncCallbacks_.Erase(num);
return RDB_ERROR;
}
ZLOGI("success");
LOG_INFO("success");
return RDB_OK;
}
@ -193,7 +194,7 @@ int32_t RdbServiceProxy::SetDistributedTables(const RdbSyncerParam& param, const
MessageParcel reply;
int32_t status = IPC_SEND(RDB_SERVICE_CMD_SET_DIST_TABLE, reply, param, tables);
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;
@ -222,11 +223,11 @@ int32_t RdbServiceProxy::Subscribe(const RdbSyncerParam &param, const SubscribeO
RdbStoreObserver *observer)
{
if (option.mode < SubscribeMode::REMOTE || option.mode >= 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 &param, 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 &param, 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 &param, const Subscrib
auto name = RemoveSuffix(param.storeName_);
observers_.ComputeIfPresent(
name, [observer](const auto& key, ObserverMapValue& value) {
ZLOGI("before remove size=%{public}d", static_cast<int>(value.first.size()));
LOG_INFO("before remove size=%{public}d", static_cast<int>(value.first.size()));
value.first.remove(observer);
ZLOGI("after remove size=%{public}d", static_cast<int>(value.first.size()));
LOG_INFO("after remove size=%{public}d", static_cast<int>(value.first.size()));
return !(value.first.empty());
});
return RDB_OK;
@ -275,7 +276,7 @@ int32_t RdbServiceProxy::DoUnSubscribe(const RdbSyncerParam &param)
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<IRemoteObject> 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 &param)
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;

View File

@ -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<uint8_t> &encryptKey, const std::string &journalMode, const std::string &syncMode,
const std::string &databaseFileType, SecurityLevel securityLevel, bool isCreateNecessary, bool autoCheck,

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "RdbStoreImpl"
#include "rdb_store_impl.h"
#include <unistd.h>
@ -53,6 +51,8 @@
#endif
namespace OHOS::NativeRdb {
using namespace OHOS::Rdb;
std::shared_ptr<RdbStoreImpl> RdbStoreImpl::Open(const RdbStoreConfig &config, int &errCode)
{
std::shared_ptr<RdbStoreImpl> rdbStore = std::make_shared<RdbStoreImpl>(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::vector<ValueObje
}
int sqlType = SqliteUtils::GetSqlStatementType(sql);
if (sqlType == SqliteUtils::STATEMENT_DDL) {
LOG_INFO("sql ddl execute.");
errCode = connectionPool->ReOpenAvailableReadConnections();
}
return errCode;

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "RdbStoreManager"
#include "rdb_store_manager.h"
#include <cinttypes>
@ -33,6 +31,8 @@
namespace OHOS {
namespace NativeRdb {
using namespace OHOS::Rdb;
RdbStoreNode::RdbStoreNode(const std::shared_ptr<RdbStoreImpl> &rdbStore)
: rdbStore_(rdbStore), taskId_(TaskExecutor::INVALID_TASK_ID)
{
@ -79,6 +79,7 @@ std::shared_ptr<RdbStore> 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);

View File

@ -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<IRemoteObject> &impl) : IRemoteProxy<IResultSet>(impl)
{
LOG_INFO("Init result set proxy.");

View File

@ -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);

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "SharedBlock"
#include "share_block.h"
#include <unistd.h>
@ -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

View File

@ -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)

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "SqliteConnection"
#include "sqlite_connection.h"
#include <cerrno>
@ -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;

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "SqliteConnectionPool"
#include "sqlite_connection_pool.h"
#include <base_transaction.h>
@ -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();

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "SqliteDatabaseUtils"
#include "sqlite_database_utils.h"
#include <sys/stat.h>
@ -43,6 +41,8 @@
namespace OHOS {
namespace NativeRdb {
using namespace OHOS::Rdb;
std::map<std::string, int> SqliteDatabaseUtils::g_statementType = SqliteDatabaseUtils::MapInit();
std::mutex SqliteDatabaseUtils::g_locker;
// Set the file access permissions is 777

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "SqliteGlobalConfig"
#include "sqlite_global_config.h"
#include <sys/stat.h>
@ -25,6 +23,7 @@
namespace OHOS {
namespace NativeRdb {
using namespace OHOS::Rdb;
void SqliteGlobalConfig::InitSqliteGlobalConfig()
{

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "SqliteSharedResultSet"
#include "sqlite_shared_result_set.h"
#include <rdb_errno.h>
@ -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<std::string> &bindArgs)
: AbsSharedResultSet(path), resultSetBlockCapacity(0), isOnlyFillResultSetBlock(false),

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "SqliteSqlBuilder"
#include "sqlite_sql_builder.h"
#include <list>
@ -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_ + "|\\*)";

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "SqliteStatement"
#include "sqlite_statement.h"
#include <iomanip>
@ -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)

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "SqliteUtils"
#include "sqlite_utils.h"
#include <sys/stat.h>
@ -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;

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "StepResultSet"
#include "step_result_set.h"
#include <unistd.h>
@ -29,6 +27,8 @@
namespace OHOS {
namespace NativeRdb {
using namespace OHOS::Rdb;
StepResultSet::StepResultSet(std::shared_ptr<RdbStoreImpl> rdb, const std::string &sql,
const std::vector<std::string> &selectionArgs)
: rdb(rdb), sql(sql), selectionArgs(selectionArgs), isAfterLast(false), rowCount(INIT_POS),

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "DataShareProfileInfo"
#include "data_share_profile_info.h"
#include <algorithm>
@ -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);

View File

@ -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> resultSet) : rdbResultSet_(resultSet)
{
}

View File

@ -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;

View File

@ -13,12 +13,10 @@
* limitations under the License.
*/
#define LOG_TAG "RdbDeviceManagerAdaptor"
#include "rdb_device_manager_adapter.h"
#include <string>
#include "rdb_device_manager_adapter.h"
namespace OHOS {
namespace DeviceManagerAdaptor {
using namespace OHOS::DistributedHardware;

View File

@ -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" ]

View File

@ -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

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "NdkRelationalCursor"
#include <iostream>
#include <sstream>
#include <string>

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "NdkRelationalPredicates"
#include "logger.h"
#include "oh_predicates.h"
#include "relational_error_code.h"

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "NdkRelationalStore"
#include "relational_store.h"
#include "logger.h"

View File

@ -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"

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "NdkRelationalValueBucket"
#include <map>
#include "logger.h"

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "RdbOpenCallbackTest"
#include "rdb_open_callback.h"
#include <gtest/gtest.h>
@ -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 {

View File

@ -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:

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "RdbStoreConfigTest"
#include <gtest/gtest.h>
#include <string>
@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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 {

View File

@ -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;

View File

@ -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 {

View File

@ -13,8 +13,6 @@
* limitations under the License.
*/
#define LOG_TAG "RdbDataShareAdapterTest"
#include <gtest/gtest.h>
#include <string>
@ -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;