You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by li...@apache.org on 2018/03/27 13:11:07 UTC

[1/2] trafodion git commit: [TRAFODION-3006] unix_timestamp runtime core dump issue

Repository: trafodion
Updated Branches:
  refs/heads/master 53f89e6dc -> fa6ae7121


[TRAFODION-3006] unix_timestamp runtime core dump issue


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/bde4454d
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/bde4454d
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/bde4454d

Branch: refs/heads/master
Commit: bde4454db07386817a754666a17ce819b9b456f2
Parents: 5339170
Author: Liu Ming <ov...@sina.com>
Authored: Wed Mar 21 19:52:55 2018 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Wed Mar 21 19:52:55 2018 +0000

----------------------------------------------------------------------
 core/sql/exp/exp_function.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/bde4454d/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index 8d9426f..67ca194 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -2591,16 +2591,22 @@ ex_expr::exp_return_type ex_function_unixtime::eval(char *op_data[],
   //if there is input value
   if( getNumOperands() == 2)
   {
-    struct tm* ptr;
-    char* r = strptime(opData, "%Y-%m-%d %H:%M:%S", ptr);
+    struct tm ptr;
+    if (opData == NULL )
+    {
+       ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+       *(*diagsArea) << DgString0("UNIX_TIMESTAMP");
+       return ex_expr::EXPR_ERROR;
+    }
+    char* r = strptime(opData, "%Y-%m-%d %H:%M:%S", &ptr);
     if( (r == NULL) ||  (*r != '\0') )
     {
-        ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
-        *(*diagsArea) << DgString0("UNIX_TIMESTAMP");
-      return ex_expr::EXPR_ERROR;
+       ExRaiseSqlError(heap, diagsArea, EXE_BAD_ARG_TO_MATH_FUNC);
+       *(*diagsArea) << DgString0("UNIX_TIMESTAMP");
+       return ex_expr::EXPR_ERROR;
     }
     else
-      *(Int64 *)op_data[0] = mktime(ptr);
+      *(Int64 *)op_data[0] = mktime(&ptr);
 
   }
   else


[2/2] trafodion git commit: merge [TRAFODION-3006]

Posted by li...@apache.org.
merge [TRAFODION-3006] 


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/fa6ae712
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/fa6ae712
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/fa6ae712

Branch: refs/heads/master
Commit: fa6ae7121ab99eb5e71462ac06357f6c7744b6a7
Parents: 53f89e6 bde4454
Author: Liu Ming <ov...@sina.com>
Authored: Tue Mar 27 07:57:29 2018 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Tue Mar 27 07:57:29 2018 +0000

----------------------------------------------------------------------
 core/sql/exp/exp_function.cpp | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------