trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sure...@apache.org
Subject [1/2] incubator-trafodion git commit: [TRAFODION-2493] to_char with format 'MONTH DD, YYYY, HH:MI' is wrong
Date Tue, 11 Apr 2017 17:31:42 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 05ff0e8eb -> 322fddace


[TRAFODION-2493] to_char with format 'MONTH DD, YYYY, HH:MI' is wrong


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

Branch: refs/heads/master
Commit: 82052c2e804ab3a7c97011a145e90adb97216df1
Parents: a0b4d85
Author: Andy Yang <yongfeng.yang@esgyn.cn>
Authored: Tue Apr 11 17:35:53 2017 +0800
Committer: Andy Yang <yongfeng.yang@esgyn.cn>
Committed: Tue Apr 11 17:35:53 2017 +0800

----------------------------------------------------------------------
 core/sql/exp/exp_datetime.cpp        | 12 ++++++++----
 core/sql/regress/seabase/EXPECTED030 |  2 +-
 2 files changed, 9 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/82052c2e/core/sql/exp/exp_datetime.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_datetime.cpp b/core/sql/exp/exp_datetime.cpp
index 8f0e677..f90aa5b 100644
--- a/core/sql/exp/exp_datetime.cpp
+++ b/core/sql/exp/exp_datetime.cpp
@@ -3399,6 +3399,8 @@ ExpDatetime::convDatetimeToASCII(char *srcData,
 
   case DATETIME_FORMAT_TS9:
     {
+      Lng32 length = ExpDatetime::getDatetimeFormatMaxLen(DATETIME_FORMAT_TS9);
+      memset(dstDataPtr, ' ', length);
       convertMonthToStrLongFormat(month, dstDataPtr, 3);
       *dstDataPtr++ = ' ';
       
@@ -3476,11 +3478,13 @@ ExpDatetime::convDatetimeToASCII(char *srcData,
       char minute = *srcData++;
       convertToAscii(minute, dstDataPtr, 2);
       if (endField > REC_DATE_MINUTE) {
-	if ((format == DATETIME_FORMAT_EUROPEAN) ||
+        if (format == DATETIME_FORMAT_TS9)
+          return (dstDataPtr - dstData);
+        else if ((format == DATETIME_FORMAT_EUROPEAN) ||
             (format == DATETIME_FORMAT_TS10))
-	  *dstDataPtr++ = '.';
-	else if (format != DATETIME_FORMAT_TS1)
-	  *dstDataPtr++ = ':';
+          *dstDataPtr++ = '.';
+        else if (format != DATETIME_FORMAT_TS1)
+          *dstDataPtr++ = ':';
        }
       break;
     }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/82052c2e/core/sql/regress/seabase/EXPECTED030
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED030 b/core/sql/regress/seabase/EXPECTED030
index 2cd9c1c..4798386 100644
--- a/core/sql/regress/seabase/EXPECTED030
+++ b/core/sql/regress/seabase/EXPECTED030
@@ -358,7 +358,7 @@
 (EXPR)                   
 -------------------------
 
-March 01, 2016, 10:11:12 
+March 01, 2016, 10:11    
 
 --- 1 row(s) selected.
 >>select to_char (time '10:23:34', 'HH24:MI:SS') from (values(1)) x(a);


Mime
View raw message