From 16ffc1a212b73b98ff646101da0ec64cb7dffe3e Mon Sep 17 00:00:00 2001
From: Francesco Pham <francesco.pham@huawei.com>
Date: Tue, 28 Mar 2023 12:15:41 +0200
Subject: [PATCH] openharmony-standard:
 appdatamgr-IsColumnNull-initialize-result.patch

add appdatamgr-IsColumnNull-initialize-result.patch and apply to
foundation/distributeddatamgr/appdatamgr

```
testIsColumnNull0003 ACTS testcase sometimes fail because the
result value of IsColumnNull is unpredictable when an error is returned.
This is because AbsSharedResultSet::IsColumnNull does not set any
value to &isNull when there is an error. The result value is
not initialized, producing an unpredictable output of IsColumnNull.
```

Signed-off-by: Francesco Pham <francesco.pham@huawei.com>
---
 ...tamgr-IsColumnNull-initialize-result.patch | 31 +++++++++++++++++++
 .../openharmony/openharmony-standard_3.0.bb   |  2 ++
 2 files changed, 33 insertions(+)
 create mode 100644 recipes-openharmony/openharmony/openharmony-standard-3.0/appdatamgr-IsColumnNull-initialize-result.patch

diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.0/appdatamgr-IsColumnNull-initialize-result.patch b/recipes-openharmony/openharmony/openharmony-standard-3.0/appdatamgr-IsColumnNull-initialize-result.patch
new file mode 100644
index 00000000..ec527d30
--- /dev/null
+++ b/recipes-openharmony/openharmony/openharmony-standard-3.0/appdatamgr-IsColumnNull-initialize-result.patch
@@ -0,0 +1,31 @@
+# SPDX-FileCopyrightText: Huawei Inc. 
+# 
+# SPDX-License-Identifier: Apache-2.0 
+
+appdatamgr/IsColumnNull: initialize result value
+
+testIsColumnNull0003 ACTS testcase sometimes fail because the
+result value of IsColumnNull is unpredictable when an error is returned.
+This is because AbsSharedResultSet::IsColumnNull does not set any
+value to &isNull when there is an error. The result value is
+not initialized, producing an unpredictable output of IsColumnNull.
+
+Apply to foundation/distributeddatamgr/appdatamgr
+ 
+Upstream-Status: Pending 
+ 
+Signed-off-by: Francesco Pham <francesco.pham@huawei.com> 
+
+diff --git a/frameworks/jskitsimpl/native_rdb/napi_result_set.cpp b/frameworks/jskitsimpl/native_rdb/napi_result_set.cpp
+index 59dd279..000fd87 100644
+--- a/frameworks/jskitsimpl/native_rdb/napi_result_set.cpp
++++ b/frameworks/jskitsimpl/native_rdb/napi_result_set.cpp
+@@ -491,7 +491,7 @@ napi_value ResultSetProxy::IsColumnNull(napi_env env, napi_callback_info info)
+ {
+     LOG_DEBUG("IsColumnNull Begin!");
+     int32_t columnIndex;
+-    bool result;
++    bool result=true;
+     size_t argc = MAX_INPUT_COUNT;
+     napi_value args[MAX_INPUT_COUNT] = { 0 };
+     napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
index 0ae43e0f..53537f6c 100644
--- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
+++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb
@@ -94,6 +94,8 @@ SRC_URI += "file://hisysevent-socket-path.patch;patchdir=${S}/base/hiviewdfx/his
 # Patch to allow /system/profile and /system/usr to be symlinks to /usr/lib/openharmony
 SRC_URI += "file://foundation_distributedschedule_safwk-slash-system-symlink.patch;patchdir=${S}/foundation/distributedschedule/safwk"
 
+SRC_URI += "file://appdatamgr-IsColumnNull-initialize-result.patch;patchdir=${S}/foundation/distributeddatamgr/appdatamgr"
+
 SRC_URI += "file://test-xts-acts-fix-Defpermission-typo.patch;patchdir=${S}/test/xts/acts"
 SRC_URI += "file://test-xts-acts-fix-faultloggertest.patch;patchdir=${S}/test/xts/acts"
 SRC_URI += "file://test-xts-acts-fix-hicolliecpptest.patch;patchdir=${S}/test/xts/acts"
-- 
GitLab