trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sure...@apache.org
Subject [2/5] incubator-trafodion git commit: fix to code review comments
Date Tue, 05 Jul 2016 13:28:49 GMT
fix to code review comments


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

Branch: refs/heads/master
Commit: c234376681e833f66b9e5edd6cb18c51f6e4d02e
Parents: 5b8eba5
Author: Liu Ming <ovis_poly@sina.com>
Authored: Thu Jun 30 01:43:28 2016 +0000
Committer: Liu Ming <ovis_poly@sina.com>
Committed: Thu Jun 30 01:43:28 2016 +0000

----------------------------------------------------------------------
 core/sql/cli/Statement.cpp    |  26 +----
 core/sql/exp/ExpError.cpp     |  25 +++++
 core/sql/exp/ExpError.h       |   5 +
 core/sql/exp/exp_conv.cpp     | 197 +++++++++++--------------------------
 core/sql/exp/exp_datetime.cpp | 153 ++++++++--------------------
 5 files changed, 133 insertions(+), 273 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c2343766/core/sql/cli/Statement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Statement.cpp b/core/sql/cli/Statement.cpp
index ae59dc0..8502e76 100644
--- a/core/sql/cli/Statement.cpp
+++ b/core/sql/cli/Statement.cpp
@@ -2102,30 +2102,6 @@ Statement * Statement::getCurrentOfCursorStatement(char * cursorName)
 
 }
 
-//////////////////////////////////////////////////////////////////
-////
-//// A helper function to show buffer in HEX
-////
-//// ///////////////////////////////////////////////////////////////
-
-static char *stringToHex(char * out, Int32 outLen, char * in, Int32 inLen)
-{
-  //clear out buffer first
-  memset(out,0,outLen);
-
-  outLen = (outLen / 2) ;
-
-  if(inLen < outLen) outLen = inLen;
-
-  char hex[3];
-  for(int i = 0; i < outLen; i++)
-  {
-    sprintf(hex, "%02x", in[i]);
-    strcat(out,hex);
-  }
-  return out;
-}
-
 ///////////////////////////////////////////////////////////////////////
 // RETURN: doSimCheck: if true, do similarity check.
 //         doFixup:    if true and doSimCheck is false, do fixup again.
@@ -2322,7 +2298,7 @@ RETCODE Statement::resolveNames(LateNameInfoList * lnil,
 	      if (retcode != ex_expr::EXPR_OK)
 		{
 		  diagsArea << DgSqlCode(-EXE_CONVERT_STRING_ERROR);
-                  char hexstr[256];
+                  char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
                   memset(hexstr, 0 , sizeof(hexstr) );
                   diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source,
sourceLen ));
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c2343766/core/sql/exp/ExpError.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpError.cpp b/core/sql/exp/ExpError.cpp
index b2edfe7..fbfb55b 100644
--- a/core/sql/exp/ExpError.cpp
+++ b/core/sql/exp/ExpError.cpp
@@ -616,3 +616,28 @@ ComDiagsArea *ExRaiseDetailSqlError(CollHeap* heap,
   NADELETEBASICARRAY(buf, (heap));
   return *diagsArea;
 }
+
+//////////////////////////////////////////////////////////////////
+////
+//// A helper function to show buffer in HEX
+////
+//// ///////////////////////////////////////////////////////////////
+
+char *stringToHex(char * out, Int32 outLen, char * in, Int32 inLen)
+{
+  //clear out buffer first
+  memset(out,0,outLen);
+
+  outLen = (outLen / 2) ;
+
+  if(inLen < outLen) outLen = inLen;
+
+  char hex[3];
+  for(int i = 0; i < outLen; i++)
+  {
+    sprintf(hex, "%02x", in[i]);
+    strcat(out,hex);
+  }
+  return out;
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c2343766/core/sql/exp/ExpError.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpError.h b/core/sql/exp/ExpError.h
index e4e77d7..fb01f9f 100644
--- a/core/sql/exp/ExpError.h
+++ b/core/sql/exp/ExpError.h
@@ -58,6 +58,8 @@ class ex_clause;
 
 class ComCondition;
 
+#define MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN  256
+
 // This version of ExRaiseSqlError is used by the expressions code.  In
 // addition to having slightly different parameters, it differs from the
 // above version in that it puts an error condition in the supplied
@@ -138,6 +140,9 @@ ComDiagsArea *ExRaiseDetailSqlError(CollHeap* heap,
                                     UInt32 flags,
                                     Int32 tgtLength = -1,
                                     Int32 tgtScale = -1);
+NA_EIDPROC
+SQLEXP_LIB_FUNC
+char *stringToHex(char * out, Int32 outLen, char * in, Int32 inLen);
                                                                 
 #endif /* EXP_ERROR_H */
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c2343766/core/sql/exp/exp_conv.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_conv.cpp b/core/sql/exp/exp_conv.cpp
index 53f16dd..5e1e870 100644
--- a/core/sql/exp/exp_conv.cpp
+++ b/core/sql/exp/exp_conv.cpp
@@ -138,30 +138,6 @@ void double_varchar_length(
 
 //////////////////////////////////////////////////////////////////
 //
-// A helper function to show buffer in HEX 
-//
-// ///////////////////////////////////////////////////////////////
-
-static char *stringToHex(char * out, Int32 outLen, char * in, Int32 inLen)
-{
-  //clear out buffer first
-  memset(out,0,outLen);
-
-  outLen = (outLen / 2) ;
-
-  if(inLen < outLen) outLen = inLen;
-
-  char hex[3];
-  for(int i = 0; i < outLen; i++)
-  {
-    sprintf(hex, "%02x", in[i]);
-    strcat(out,hex);
-  }
-  return out;
-}
-
-//////////////////////////////////////////////////////////////////
-//
 //A helper function to return charset name
 //
 /////////////////////////////////////////////////////////////////
@@ -1444,10 +1420,8 @@ ex_expr::exp_return_type convUnicodeToDatetime(char *target,
       }
    }
 
-   ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-   char hexstr[256];
-   if(*diagsArea)
-     **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr) , source, sourceLen
));
+   char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+   ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR, NULL, NULL, NULL, NULL, stringToHex(hexstr,
sizeof(hexstr) , source, sourceLen ));
 
    return ex_expr::EXPR_ERROR;
 
@@ -1536,10 +1510,8 @@ ex_expr::exp_return_type convDatetimeDatetime(char * target,
                                              validateFlag,
                                              &roundedDown) != 0) {
 
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    char hexstr[256];
-    if(*diagsArea)
-      **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+    char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
     return ex_expr::EXPR_ERROR;
   }
 
@@ -1585,10 +1557,8 @@ ex_expr::exp_return_type convAsciiToFloat64(char * target,
       }
 
     // string contains only blanks.
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-    char hexstr[256];
-    if(*diagsArea)
-      **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+    char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
     return ex_expr::EXPR_ERROR;
   };
 
@@ -1739,11 +1709,8 @@ ex_expr::exp_return_type convAsciiToFloat64(char * target,
 	case ERROR:
 	  {
 	    // string contains only blanks.
-	    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-            char hexstr[256];
-            if(*diagsArea)
-              **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source,
sourceLen ));
-
+            char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+	    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 	    return ex_expr::EXPR_ERROR;
 	  };
 	  break;
@@ -1761,10 +1728,8 @@ ex_expr::exp_return_type convAsciiToFloat64(char * target,
   if (NOT validNum)
     {
 	  // LCOV_EXCL_START
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-      char hexstr[256];
-      if(*diagsArea)
-        **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
       return ex_expr::EXPR_ERROR;
       // LCOV_EXCL_STOP
     };
@@ -1861,10 +1826,8 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
       if (!DigitsAllowed)
         {
 	// syntax error in the input
-        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-        char hexstr[256];
-        if(*diagsArea)
-          **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
 	return ex_expr::EXPR_ERROR;
         }
@@ -1963,10 +1926,8 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
 	// we found already a sign or we found already digits
         // or we found a point already.
         // A sign is an error now!
-	ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-        char hexstr[256];
-        if(*diagsArea)
-          **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+	ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
 	return ex_expr::EXPR_ERROR;
         }
@@ -1980,10 +1941,8 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
 	// we found a second decimal point. This is an error
         // we are already not allowing anymore digits because of illegal
         // blank space(s)
-	ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-        char hexstr[256];
-        if(*diagsArea)
-          **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+	ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
 	return ex_expr::EXPR_ERROR;
         }
@@ -1999,10 +1958,8 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
 	  if (currPos == 0)
 	    {
 	      // 'E' alone is not a valid numeric.
-	      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-              char hexstr[256];
-              if(*diagsArea)
-                **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source,
sourceLen ));
+              char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+	      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
 	      return ex_expr::EXPR_ERROR;
 	    }
@@ -2036,10 +1993,8 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
       else
         {
 	  // illegal character in this input string
-	  ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-          char hexstr[256];
-          if(*diagsArea)
-            **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+          char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+	  ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
 	  return ex_expr::EXPR_ERROR;
         }
@@ -2057,10 +2012,8 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
 	  return ex_expr::EXPR_OK;
 	}
       
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-      char hexstr[256];
-      if(*diagsArea)
-        **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
       return ex_expr::EXPR_ERROR;
     }
@@ -2205,10 +2158,8 @@ ex_expr::exp_return_type convAsciiToDec(char *target,
 	return ex_expr::EXPR_OK;
       }
  
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-    char hexstr[256];
-    if(*diagsArea)
-      **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+    char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
     return ex_expr::EXPR_ERROR;
   };
@@ -2328,10 +2279,8 @@ ex_expr::exp_return_type convAsciiToDec(char *target,
     else {
       // if source is not a digit, we have an error
       if (source[sourcePos] < '0' || source[sourcePos] > '9') {
-	ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-        char hexstr[256];
-        if(*diagsArea)
-          **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+	ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
         return ex_expr::EXPR_ERROR;
       };
@@ -2588,10 +2537,8 @@ ex_expr::exp_return_type convAsciiFieldToInt64(Int64 &target,
   if (!currPos)
   {
     // No digits were found
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-    char hexstr[256];
-    if(*diagsArea)
-      **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+    char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
     return ex_expr::EXPR_ERROR;
   }
@@ -3436,10 +3383,8 @@ ex_expr::exp_return_type convDecToInt64(Int64 &target,
   // Convert the value to a negative binary number.  Check for overflow.
   while (currPos < sourceLen) {
     if (source[currPos] < '0' || source[currPos] > '9') {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-      char hexstr[256];
-      if(*diagsArea)
-        **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
       return ex_expr::EXPR_ERROR;
     };
@@ -3489,10 +3434,8 @@ ex_expr::exp_return_type convDecToDec(char *target,
     if ((source[0] & 0177) != '0') {
 
       // target string is not long enough - overflow
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-      char hexstr[256];
-      if(*diagsArea)
-        **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
       return ex_expr::EXPR_ERROR;
     };
@@ -3500,10 +3443,8 @@ ex_expr::exp_return_type convDecToDec(char *target,
     Lng32 sourceIndex = sourceLen - targetLen;
     for (Lng32 i = 1; i < sourceIndex; i++)
       if (source[i] != '0') {
-	ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-        char hexstr[256];
-        if(*diagsArea)
-          **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+	ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
         return ex_expr::EXPR_ERROR;
       };
@@ -4405,10 +4346,8 @@ unicodeToSByteTarget(
 
        if ( allowInvalidCodePoint == FALSE )
        {
-          ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHAR_IN_TRANSLATE_FUNC);
-          char hexstr[256];
-          if(*diagsArea)
-            *(*diagsArea) << DgString0("UNICODE") << DgString1("ISO88591") <<
DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
+          char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+          ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHAR_IN_TRANSLATE_FUNC,NULL,NULL,NULL,NULL,"UNICODE","ISO88591",stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
           retcode = ex_expr::EXPR_ERROR;
        }
     }
@@ -4503,8 +4442,8 @@ unicodeToMByteTarget(
 
        if ( allowInvalidCodePoint == FALSE )
        {
+          char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
           ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHAR_IN_TRANSLATE_FUNC);
-          char hexstr[256];
           if( *diagsArea ) {
 	    if ( targetScale == SQLCHARSETCODE_UTF8 )
               *(*diagsArea) << DgString0("UNICODE") << DgString1("UTF8") <<
DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
@@ -4643,9 +4582,8 @@ ex_expr::exp_return_type convCharToChar(
           ExRaiseSqlError(heap, diagsArea, errCode);
           if(errCode == EXE_INVALID_CHAR_IN_TRANSLATE_FUNC)
           {
-            char hexstr[256];
-            if( *diagsArea ) 
-              *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale))
<< DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
+            char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+            *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale))
<< DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
           }
           if (intermediateStr && intermediateStr != stackBuffer)
             NADELETEBASIC(intermediateStr, heap);
@@ -4786,9 +4724,8 @@ ex_expr::exp_return_type convCharToChar(
                       ExRaiseSqlError(heap, diagsArea, errCode);
                       if(errCode == EXE_INVALID_CHAR_IN_TRANSLATE_FUNC)
                       {
-                        char hexstr[256];
-                        if( *diagsArea ) 
-                          *(*diagsArea) << DgString0(scaleToString(sourceScale)) <<
DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
+                        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN ];
+                        *(*diagsArea) << DgString0(scaleToString(sourceScale)) <<
DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
                       }
                       if (intermediateStr && intermediateStr != stackBuffer)
                         NADELETEBASIC(intermediateStr, heap);
@@ -4832,9 +4769,8 @@ ex_expr::exp_return_type convCharToChar(
          {
              // source string is not valid UTF-8
              ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHAR_IN_TRANSLATE_FUNC);
-             char hexstr[256];
-             if( *diagsArea ) 
-               *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale))
<< DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
+             char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+             *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale))
<< DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
              return ex_expr::EXPR_ERROR;
          }
       }
@@ -4860,9 +4796,8 @@ ex_expr::exp_return_type convCharToChar(
                 {
                   // source string is not valid UTF-8
                   ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHAR_IN_TRANSLATE_FUNC);
-                  char hexstr[256];
-                  if( *diagsArea ) 
-                    *(*diagsArea) << DgString0(scaleToString(sourceScale)) <<
DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
+                  char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+                  *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale))
<< DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
                   return ex_expr::EXPR_ERROR;
                 }
 
@@ -8650,10 +8585,8 @@ convDoIt(char * source,
          double_varchar_length(varCharLen, varCharLenSize);
 
    } else {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
-      if( *diagsArea ) 
-        **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
       ok = ex_expr::EXPR_ERROR;
    }
@@ -8739,10 +8672,8 @@ convDoIt(char * source,
 
       ok = ex_expr::EXPR_OK;
    } else {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
-      if( *diagsArea ) 
-        **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL, NULL, NULL, NULL,
stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
       ok = ex_expr::EXPR_ERROR;
    }
 
@@ -9097,10 +9028,8 @@ convDoIt(char * source,
 
       ok = ex_expr::EXPR_OK;
    } else {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-      char hexstr[256];
-      if( *diagsArea ) 
-        **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR, NULL, NULL, NULL, NULL,stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
       ok = ex_expr::EXPR_ERROR;
    }
@@ -9175,10 +9104,8 @@ convDoIt(char * source,
       }
    }
 
-   ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-   char hexstr[256];
-   if( *diagsArea ) 
-     **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+   char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+   ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL, NULL, NULL, NULL, stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
    return ex_expr::EXPR_ERROR;
   };
@@ -9339,10 +9266,8 @@ convDoIt(char * source,
       }
    }
 
-   ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-   char hexstr[256];
-   if( *diagsArea ) 
-     **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+   char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+   ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL, NULL, NULL, NULL, stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
    return ex_expr::EXPR_ERROR;
 
@@ -9383,10 +9308,8 @@ convDoIt(char * source,
       }
    }
 
-   ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-   char hexstr[256];
-   if( *diagsArea ) 
-     **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+   char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+   ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR, NULL, NULL, NULL, NULL, stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
    return ex_expr::EXPR_ERROR;
   };
   break;
@@ -9489,10 +9412,8 @@ convDoIt(char * source,
       copyLen = 0;
       if ( varCharLen )
         setVCLength(varCharLen, varCharLenSize, copyLen);
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-      char hexstr[256];
-      if( *diagsArea ) 
-        **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen
));
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL, NULL, NULL, NULL, stringToHex(hexstr,
sizeof(hexstr), source, sourceLen ));
 
       return ex_expr::EXPR_ERROR;
       // LCOV_EXCL_STOP

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c2343766/core/sql/exp/exp_datetime.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_datetime.cpp b/core/sql/exp/exp_datetime.cpp
index 952fba0..627d456 100644
--- a/core/sql/exp/exp_datetime.cpp
+++ b/core/sql/exp/exp_datetime.cpp
@@ -1752,30 +1752,6 @@ containsField(rec_datetime_field field,
   }
 }
 
-//////////////////////////////////////////////////////////////////
-////
-//// A helper function to show buffer in HEX
-////
-//// ///////////////////////////////////////////////////////////////
-
-static char *stringToHex(char * out, Int32 outLen, char * in, Int32 inLen)
-{
-  //clear out buffer first
-  memset(out,0,outLen);
-
-  outLen = (outLen / 2) ;
-
-  if(inLen < outLen) outLen = inLen;
-
-  char hex[3];
-  for(int i = 0; i < outLen; i++)
-  {
-    sprintf(hex, "%02x", in[i]);
-    strcat(out,hex);
-  }
-  return out;
-}
-
 // scanField() =======================================================
 // This static helper function for the ExpDatetime class is used to
 // scan the various fields of a ASCII datetime value.
@@ -1931,11 +1907,8 @@ scanField(char *&src,
     else {
       // An unknown character was encountered in the string.
       //
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
-      char hexstr[256];
-      memset(hexstr, 0 , sizeof(hexstr) );
-      if(*diagsArea)
-        **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), src, srcEnd-src));
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR,NULL,NULL,NULL,NULL,stringToHex(hexstr,
sizeof(hexstr), src, srcEnd-src));
 
       return FALSE;
     }
@@ -2050,15 +2023,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
   // If the format could not be determined, issue an error.
   //
   if (format == DATETIME_FORMAT_ERROR) {
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    char hexstr[256];
+    char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
     memset(hexstr, 0 , sizeof(hexstr) );
     int copyLen = strlen(originalSrcData);
     if(copyLen > sizeof(hexstr) -1 )
       copyLen = sizeof(hexstr) -1;
     strncpy(hexstr,originalSrcData,copyLen);
-    if(*diagsArea != NULL)
-      **diagsArea << DgString0(hexstr); 
+    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
     return -1;
   }
 
@@ -2094,15 +2065,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
   // if timezone is specified and end field is not DAY, return error.
   if ((defZ || TZD) && (dstEndField == REC_DATE_DAY))
     {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
       memset(hexstr, 0 , sizeof(hexstr) );
       int copyLen = strlen(originalSrcData);
       if(copyLen > sizeof(hexstr) -1 )
         copyLen = sizeof(hexstr) -1;
       strncpy(hexstr,originalSrcData,copyLen);
-      if(*diagsArea != NULL)
-        **diagsArea << DgString0(hexstr); 
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
       return -1;
     }
 
@@ -2199,7 +2168,7 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
                      diagsArea,
    	             flags)) {
         ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-        char hexstr[256];
+        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
         memset(hexstr, 0 , sizeof(hexstr) );
         int copyLen = strlen(originalSrcData);
         if(copyLen > sizeof(hexstr) -1 )
@@ -2214,15 +2183,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
 
   // If there are any remaining characters in the input string.
   if (src != srcEnd) {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
       memset(hexstr, 0 , sizeof(hexstr) );
       int copyLen = strlen(originalSrcData);
       if(copyLen > sizeof(hexstr) -1 )
           copyLen = sizeof(hexstr) -1;
       strncpy(hexstr,originalSrcData,copyLen);
-      if(*diagsArea != NULL)
-        **diagsArea << DgString0(hexstr); 
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
       return -1;
   }
 
@@ -2233,15 +2200,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
       containsField(REC_DATE_HOUR, dstStartField, dstEndField) &&
       usaAmPm) {
     if (datetimeValues[REC_DATE_HOUR] > 12) {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
       memset(hexstr, 0 , sizeof(hexstr) );
       int copyLen = strlen(originalSrcData);
       if(copyLen > sizeof(hexstr) -1 )
           copyLen = sizeof(hexstr) -1;
       strncpy(hexstr,originalSrcData,copyLen);
-      if(*diagsArea != NULL)
-        **diagsArea << DgString0(hexstr); 
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
       return -1;
     }
 
@@ -2261,15 +2226,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
       }
     }
   } else if (usaAmPm) {
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    char hexstr[256];
+    char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
     memset(hexstr, 0 , sizeof(hexstr) );
     int copyLen = strlen(originalSrcData);
     if(copyLen > sizeof(hexstr) -1 )
           copyLen = sizeof(hexstr) -1;
     strncpy(hexstr,originalSrcData,copyLen);
-    if(*diagsArea != NULL)
-      **diagsArea << DgString0(hexstr); 
+    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
     return -1;
   }
     
@@ -2319,15 +2282,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
       }
       break;
     default:
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
       memset(hexstr, 0 , sizeof(hexstr) );
       int copyLen = strlen(originalSrcData);
       if(copyLen > sizeof(hexstr) - 1 ) 
         copyLen = sizeof(hexstr) - 1; 
       strncpy(hexstr,originalSrcData, copyLen);
-      if(*diagsArea != NULL)
-        **diagsArea << DgString0(hexstr); 
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
       return -1;
     }
   }
@@ -2340,15 +2301,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
     if (validateDate(dstStartField, dstEndField, 
 		     dstData, NULL, FALSE, 
 		     LastDayPrevMonth)) {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
       memset(hexstr, 0 , sizeof(hexstr) );
       int copyLen = strlen(originalSrcData);
       if(copyLen > sizeof(hexstr) - 1 ) 
         copyLen = sizeof(hexstr) - 1; 
       strncpy(hexstr,originalSrcData, copyLen);
-      if(*diagsArea != NULL)
-        **diagsArea << DgString0(hexstr); 
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
       return -1;
     };
 
@@ -2364,15 +2323,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
     short error;
     Int64 juliantimestamp = COMPUTETIMESTAMP(timestamp, &error);
     if (error) {
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
       memset(hexstr, 0 , sizeof(hexstr) );
       int copyLen = strlen(originalSrcData);
       if(copyLen > sizeof(hexstr) - 1 ) 
         copyLen = sizeof(hexstr) - 1; 
       strncpy(hexstr,originalSrcData, copyLen);
-      if(*diagsArea != NULL)
-        **diagsArea << DgString0(hexstr); 
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
       return -1;
     }
 
@@ -2420,15 +2377,13 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
         }
         break;
       default:
-        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-        char hexstr[256];
+        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
         memset(hexstr, 0 , sizeof(hexstr) );
         int copyLen = strlen(originalSrcData);
         if(copyLen > sizeof(hexstr) - 1 ) 
           copyLen = sizeof(hexstr) - 1; 
         strncpy(hexstr,originalSrcData, copyLen);
-        if(*diagsArea != NULL)
-          **diagsArea << DgString0(hexstr); 
+        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
         return -1;
       }
     }
@@ -2503,14 +2458,12 @@ static NABoolean convertStrToMonth(char* &srcData, char *result,
               if (*srcData != *nextByte)
                 {
                   // string contains non-digit
-                  ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-                  char hexstr[256];
+                  char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
                   memset(hexstr, 0 , sizeof(hexstr) );
                   if(copyLen > sizeof(hexstr) -1 ) 
                     copyLen = sizeof(hexstr) -1;        
                   strncpy(hexstr,originalSrcData,copyLen);
-                  if(*diagsArea != NULL)
-                    **diagsArea << DgString0(hexstr); 
+                  ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
                   return FALSE; // error
                 }    
               srcData++;
@@ -2574,15 +2527,13 @@ static short convSrcDataToDst(Lng32 numSrcBytes, char* &srcData,
     {
       // string contains non-digit
       //
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
       memset(hexstr, 0 , sizeof(hexstr) );
       int copyLen = strlen(srcData);
       if( copyLen > sizeof(hexstr) - 1)
          copyLen = sizeof(hexstr) - 1; 
       strncpy(hexstr,srcData,copyLen);
-      if(*diagsArea != NULL)
-        **diagsArea << DgString0(hexstr); 
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
       return -1;
     }
 
@@ -2600,15 +2551,13 @@ static short convSrcDataToDst(Lng32 numSrcBytes, char* &srcData,
       if (*srcData != *nextByte)
         {
           // string contains non-digit
-          ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-          char hexstr[256];
+          char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
           memset(hexstr, 0 , sizeof(hexstr) );
           int copyLen = strlen(srcData);
           if( copyLen > sizeof(hexstr) - 1)
             copyLen = sizeof(hexstr) - 1; 
           strncpy(hexstr,srcData,copyLen);
-          if(*diagsArea != NULL)
-            **diagsArea << DgString0(hexstr); 
+          ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
           return -1;
         }    
 
@@ -2671,15 +2620,13 @@ ExpDatetime::convAsciiToDate(char *srcData,
     if (i == srcLen) {
       // string contains only blanks.
       //
-      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-      char hexstr[256];
+      char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
       memset(hexstr, 0 , sizeof(hexstr) );
       int copyLen = strlen(srcData);
       if(copyLen > sizeof(hexstr) - 1)
         copyLen = sizeof(hexstr) - 1;
       strncpy(hexstr,srcData,copyLen);
-      if(*diagsArea != NULL)
-        **diagsArea << DgString0(hexstr); 
+      ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
       return -1;
     };
 
@@ -2698,15 +2645,13 @@ ExpDatetime::convAsciiToDate(char *srcData,
   if ((minLength <= 0) || (srcLen < minLength)) {
     // string doesn't seem to contain all date fields.
     //
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    char hexstr[256];
+    char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
     memset(hexstr, 0 , sizeof(hexstr) );
     int copyLen = strlen(srcData);
     if(copyLen > sizeof(hexstr) - 1)
       copyLen = sizeof(hexstr) - 1;
     strncpy(hexstr,srcData,copyLen);
-    if(*diagsArea != NULL)
-      **diagsArea << DgString0(hexstr); 
+    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
     return -1;
   };
 
@@ -2917,15 +2862,13 @@ ExpDatetime::convAsciiToDate(char *srcData,
       // the month
       char * prevSrcData = srcData;
       if (! convertStrToMonthLongFormat(srcData, &dstData[2])) {
-        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-        char hexstr[256];
+        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
         memset(hexstr, 0 , sizeof(hexstr) );
         int copyLen = strlen(srcData);
         if(copyLen > sizeof(hexstr) -1 )
           copyLen = sizeof(hexstr) -1 ;
         strncpy(hexstr,srcData,copyLen);
-        if(*diagsArea != NULL)
-          **diagsArea << DgString0(hexstr); 
+        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
         return -1;
       }
       minLength += (srcData - prevSrcData);
@@ -3092,15 +3035,13 @@ ExpDatetime::convAsciiToDate(char *srcData,
     {
     // Format could not be determined, issue an error.
     //
-    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-    char hexstr[256];
+    char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
     memset(hexstr, 0 , sizeof(hexstr) );
     int copyLen = strlen(srcData);
     if(copyLen > sizeof(hexstr) -1 )
       copyLen = sizeof(hexstr) -1 ;
     strncpy(hexstr,srcData,copyLen);
-    if(*diagsArea != NULL)
-      **diagsArea << DgString0(hexstr); 
+    ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
     return -1;
     }
   };
@@ -3113,15 +3054,13 @@ ExpDatetime::convAsciiToDate(char *srcData,
       if (srcData[i] != ' ') {
         // string contains only blanks.
         //
-        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-        char hexstr[256];
+        char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
         memset(hexstr, 0 , sizeof(hexstr) );
         int copyLen = strlen(srcData);
         if(copyLen > sizeof(hexstr) -1 )
           copyLen = sizeof(hexstr) -1 ;
         strncpy(hexstr,srcData,copyLen);
-        if(*diagsArea != NULL)
-          **diagsArea << DgString0(hexstr); 
+        ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
         return -1;
       }
     }
@@ -3135,15 +3074,13 @@ ExpDatetime::convAsciiToDate(char *srcData,
 	if (validateDate(REC_DATE_YEAR, REC_DATE_DAY, 
 			 dstData, NULL, FALSE, 
 			 LastDayPrevMonth)) {
-	  ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-          char hexstr[256];
+          char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
           memset(hexstr, 0 , sizeof(hexstr) );
           int copyLen = strlen(srcData);
           if(copyLen > sizeof(hexstr) -1 )
             copyLen = sizeof(hexstr) -1 ;
           strncpy(hexstr,srcData,copyLen);
-          if(*diagsArea != NULL)
-            **diagsArea << DgString0(hexstr); 
+	  ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
 	  return -1;
 	};
     }
@@ -3737,15 +3674,13 @@ ExpDatetime::convNumericTimeToASCII(char *srcData,
       // cannot convert negative number with NUM1 format
       if (format == DATETIME_FORMAT_NUM1)
         {
-          ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-          char hexstr[256];
+          char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
           memset(hexstr, 0 , sizeof(hexstr) );
           int copyLen = strlen(srcData);
           if(copyLen > sizeof(hexstr) -1 )
             copyLen = sizeof(hexstr) -1;
           strncpy(hexstr,srcData,copyLen);
-          if(*diagsArea != NULL)
-            **diagsArea << DgString0(hexstr);
+          ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
           return -1;
         }
 
@@ -3783,15 +3718,13 @@ ExpDatetime::convNumericTimeToASCII(char *srcData,
       // if more digits left in input, error out.
       if (temp > 0)
         {
-          ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
-          char hexstr[256];
+          char hexstr[MAX_OFFENDING_SOURCE_DATA_DISPLAY_LEN];
           memset(hexstr, 0 , sizeof(hexstr) );
           int copyLen = strlen(srcData);
           if(copyLen > sizeof(hexstr) -1 )
             copyLen = sizeof(hexstr) -1;
           strncpy(hexstr,srcData,copyLen);
-          if(*diagsArea != NULL)
-            **diagsArea << DgString0(hexstr);
+          ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR,NULL,NULL,NULL,NULL,hexstr);
           return -1;
         }
 



Mime
View raw message