You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2018/02/07 17:30:45 UTC
[1/4] trafodion git commit: [TRAFODION-2772] - retrieve a value from
Json string got an error
Repository: trafodion
Updated Branches:
refs/heads/master 86c2284f6 -> 8d3f7edc8
[TRAFODION-2772] - retrieve a value from Json string got an error
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/b2984e1f
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/b2984e1f
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/b2984e1f
Branch: refs/heads/master
Commit: b2984e1ff96423d82ebd86d4e9a7e2beb6fb40d1
Parents: d80f009
Author: Andy Yang <yo...@esgyn.cn>
Authored: Mon Feb 5 16:32:19 2018 +0800
Committer: Andy Yang <yo...@esgyn.cn>
Committed: Mon Feb 5 16:32:19 2018 +0800
----------------------------------------------------------------------
core/sql/exp/exp_function.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafodion/blob/b2984e1f/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index 1f757fa..c439559 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -6503,8 +6503,15 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char *op_data[
Int32 prec2 = ((SimpleType *)getOperand(2))->getPrecision();
len2 = Attributes::trimFillerSpaces( op_data[2], prec2, len2, cs );
}
+
char *rltStr = NULL;
- JsonReturnType ret = json_extract_path_text(&rltStr, op_data[1], 1, op_data[2]);
+ char *jsonStr = new(heap) char[len1+1];
+ char *jsonAttr = new(heap) char[len2+1];
+ strncpy(jsonStr, op_data[1], len1);
+ jsonStr[len1] = '\0';
+ strncpy(jsonAttr, op_data[2], len2);
+ jsonAttr[len2] = '\0';
+ JsonReturnType ret = json_extract_path_text(&rltStr, jsonStr, 1, jsonAttr);
if (ret != JSON_OK)
{
ExRaiseJSONError(heap, diagsArea, ret);
[2/4] trafodion git commit: [TRAFODION-2772] - retrieve a value from
Json string got an error: release memory to heap
Posted by db...@apache.org.
[TRAFODION-2772] - retrieve a value from Json string got an error: release memory to heap
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/f9888bc0
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/f9888bc0
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/f9888bc0
Branch: refs/heads/master
Commit: f9888bc0b2ec65af99f757d3b2d1299c57734e1a
Parents: b2984e1
Author: Andy Yang <yo...@esgyn.cn>
Authored: Tue Feb 6 18:13:31 2018 +0800
Committer: Andy Yang <yo...@esgyn.cn>
Committed: Tue Feb 6 18:13:31 2018 +0800
----------------------------------------------------------------------
core/sql/exp/exp_function.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafodion/blob/f9888bc0/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index c439559..b802289 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -6514,6 +6514,10 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char *op_data[
JsonReturnType ret = json_extract_path_text(&rltStr, jsonStr, 1, jsonAttr);
if (ret != JSON_OK)
{
+ if (jsonStr)
+ NADELETEBASIC(jsonStr,(heap));
+ if (jsonAttr)
+ NADELETEBASIC(jsonAttr,(heap));
ExRaiseJSONError(heap, diagsArea, ret);
return ex_expr::EXPR_ERROR;
}
@@ -6531,6 +6535,11 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char *op_data[
else
getOperand(0)->setVarLength(0, op_data[-MAX_OPERANDS]);
+ if (jsonStr)
+ NADELETEBASIC(jsonStr,(heap));
+ if (jsonAttr)
+ NADELETEBASIC(jsonAttr,(heap));
+
return ex_expr::EXPR_OK;
}
[3/4] trafodion git commit: [TRAFODION-2772] - retrieve a value from
Json string got an error: using array to replace dynamic memory
Posted by db...@apache.org.
[TRAFODION-2772] - retrieve a value from Json string got an error: using array to replace dynamic memory
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/f8726b4d
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/f8726b4d
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/f8726b4d
Branch: refs/heads/master
Commit: f8726b4d7efc6d9ca9115ce8e4ffbc69815c3b57
Parents: f9888bc
Author: Andy Yang <yo...@esgyn.cn>
Authored: Wed Feb 7 15:55:32 2018 +0800
Committer: Andy Yang <yo...@esgyn.cn>
Committed: Wed Feb 7 15:55:32 2018 +0800
----------------------------------------------------------------------
core/sql/exp/exp_function.cpp | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafodion/blob/f8726b4d/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index b802289..13815a3 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -6505,8 +6505,8 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char *op_data[
}
char *rltStr = NULL;
- char *jsonStr = new(heap) char[len1+1];
- char *jsonAttr = new(heap) char[len2+1];
+ char jsonStr[len1+1];
+ char jsonAttr[len2+1];
strncpy(jsonStr, op_data[1], len1);
jsonStr[len1] = '\0';
strncpy(jsonAttr, op_data[2], len2);
@@ -6514,10 +6514,6 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char *op_data[
JsonReturnType ret = json_extract_path_text(&rltStr, jsonStr, 1, jsonAttr);
if (ret != JSON_OK)
{
- if (jsonStr)
- NADELETEBASIC(jsonStr,(heap));
- if (jsonAttr)
- NADELETEBASIC(jsonAttr,(heap));
ExRaiseJSONError(heap, diagsArea, ret);
return ex_expr::EXPR_ERROR;
}
@@ -6535,11 +6531,6 @@ ex_expr::exp_return_type ex_function_json_object_field_text::eval(char *op_data[
else
getOperand(0)->setVarLength(0, op_data[-MAX_OPERANDS]);
- if (jsonStr)
- NADELETEBASIC(jsonStr,(heap));
- if (jsonAttr)
- NADELETEBASIC(jsonAttr,(heap));
-
return ex_expr::EXPR_OK;
}
[4/4] trafodion git commit: Merge [TRAFODION-2772] PR 1439 Fix bug in
retriving value from JSON string
Posted by db...@apache.org.
Merge [TRAFODION-2772] PR 1439 Fix bug in retriving value from JSON string
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/8d3f7edc
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/8d3f7edc
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/8d3f7edc
Branch: refs/heads/master
Commit: 8d3f7edc86cfd1db7e953ff5efe5e73e4dfa91fc
Parents: 86c2284 f8726b4
Author: Dave Birdsall <db...@apache.org>
Authored: Wed Feb 7 17:29:50 2018 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Wed Feb 7 17:29:50 2018 +0000
----------------------------------------------------------------------
core/sql/exp/exp_function.cpp | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------