You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by su...@apache.org on 2016/07/05 13:28:48 UTC
[1/5] incubator-trafodion git commit: [TRAFODION-1676]support better
runtime error message when a SQL function meet fital error
Repository: incubator-trafodion
Updated Branches:
refs/heads/master f1b85eebd -> d3de6851a
[TRAFODION-1676]support better runtime error message when a SQL function meet fital error
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/5b8eba55
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/5b8eba55
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/5b8eba55
Branch: refs/heads/master
Commit: 5b8eba5598f8e45339a1ba649cd2214117ed7381
Parents: 4934fde
Author: Liu Ming <ov...@sina.com>
Authored: Wed Jun 29 12:47:38 2016 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Wed Jun 29 12:47:38 2016 +0000
----------------------------------------------------------------------
core/sql/bin/SqlciErrors.txt | 4 +-
core/sql/cli/Statement.cpp | 28 ++++
core/sql/exp/exp_conv.cpp | 122 ++++++++++++++--
core/sql/exp/exp_datetime.cpp | 203 +++++++++++++++++++++++++-
core/sql/exp/exp_function.cpp | 33 ++++-
core/sql/regress/core/EXPECTED038.LINUX | 2 +-
core/sql/regress/executor/EXPECTED022.SB | 152 +++++++++----------
core/sql/regress/executor/EXPECTED050 | 4 +-
core/sql/regress/hive/EXPECTED005 | 10 +-
core/sql/regress/seabase/EXPECTED030 | 6 +-
10 files changed, 453 insertions(+), 111 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/bin/SqlciErrors.txt
----------------------------------------------------------------------
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index ec84dd9..6c8933d 100644
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@ -1529,9 +1529,9 @@ $1~String1 --------------------------------
8410 22025 99999 BEGINNER MINOR LOGONLY An escape character in a LIKE pattern must be followed by another escape character, an underscore, or a percent character.
8411 22003 99999 BEGINNER MINOR LOGONLY A numeric overflow occurred during an arithmetic computation or data conversion.$0~string0
8412 22024 99999 BEGINNER MINOR LOGONLY An input character host variable is missing its null terminator.
-8413 22007 99999 BEGINNER MINOR LOGONLY The string argument contains characters that cannot be converted.
+8413 22007 99999 BEGINNER MINOR LOGONLY The string argument contains characters that cannot be converted. Source data $0~string0
8414 0A000 99999 BEGINNER MINOR LOGONLY The attempted conversion is not supported on this platform.
-8415 22007 99999 BEGINNER MINOR LOGONLY The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+8415 22007 99999 BEGINNER MINOR LOGONLY The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data $0~string0
8416 22008 99999 BEGINNER MINOR LOGONLY A datetime expression evaluated to an invalid datetime value.
8417 ZZZZZ 99999 BEGINNER MAJOR DBADMIN An error occurred during the evaluation of USER function. The provided userid $0~string0 is invalid, incorrect, obsolete or inexistent and could not be converted to username.
8418 0A000 99999 BEGINNER MINOR LOGONLY The USER function is not supported on this platform.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/cli/Statement.cpp
----------------------------------------------------------------------
diff --git a/core/sql/cli/Statement.cpp b/core/sql/cli/Statement.cpp
index a1f2171..ae59dc0 100644
--- a/core/sql/cli/Statement.cpp
+++ b/core/sql/cli/Statement.cpp
@@ -2102,6 +2102,30 @@ 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.
@@ -2298,6 +2322,10 @@ RETCODE Statement::resolveNames(LateNameInfoList * lnil,
if (retcode != ex_expr::EXPR_OK)
{
diagsArea << DgSqlCode(-EXE_CONVERT_STRING_ERROR);
+ char hexstr[256];
+ memset(hexstr, 0 , sizeof(hexstr) );
+ diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
+
return ERROR;
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/exp/exp_conv.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_conv.cpp b/core/sql/exp/exp_conv.cpp
index 034c9e3..53f16dd 100644
--- a/core/sql/exp/exp_conv.cpp
+++ b/core/sql/exp/exp_conv.cpp
@@ -1445,6 +1445,10 @@ 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 ));
+
return ex_expr::EXPR_ERROR;
}
@@ -1533,6 +1537,9 @@ ex_expr::exp_return_type convDatetimeDatetime(char * target,
&roundedDown) != 0) {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ if(*diagsArea)
+ **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
return ex_expr::EXPR_ERROR;
}
@@ -1579,6 +1586,9 @@ 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 ));
return ex_expr::EXPR_ERROR;
};
@@ -1730,6 +1740,10 @@ 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 ));
+
return ex_expr::EXPR_ERROR;
};
break;
@@ -1748,6 +1762,9 @@ ex_expr::exp_return_type convAsciiToFloat64(char * target,
{
// LCOV_EXCL_START
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
+ char hexstr[256];
+ if(*diagsArea)
+ **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
return ex_expr::EXPR_ERROR;
// LCOV_EXCL_STOP
};
@@ -1845,6 +1862,10 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
{
// 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 ));
+
return ex_expr::EXPR_ERROR;
}
digitCnt++;
@@ -1943,6 +1964,10 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
// 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 ));
+
return ex_expr::EXPR_ERROR;
}
SignFound = TRUE;
@@ -1956,6 +1981,10 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
// 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 ));
+
return ex_expr::EXPR_ERROR;
}
pointFound = TRUE;
@@ -1971,6 +2000,10 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
{
// '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 ));
+
return ex_expr::EXPR_ERROR;
}
@@ -2004,6 +2037,10 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
{
// 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 ));
+
return ex_expr::EXPR_ERROR;
}
}
@@ -2021,6 +2058,10 @@ ex_expr::exp_return_type convAsciiToInt64(Int64 &target,
}
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
+ char hexstr[256];
+ if(*diagsArea)
+ **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
+
return ex_expr::EXPR_ERROR;
}
@@ -2165,6 +2206,10 @@ ex_expr::exp_return_type convAsciiToDec(char *target,
}
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
+ char hexstr[256];
+ if(*diagsArea)
+ **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
+
return ex_expr::EXPR_ERROR;
};
// LCOV_EXCL_STOP
@@ -2284,6 +2329,10 @@ ex_expr::exp_return_type convAsciiToDec(char *target,
// 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 ));
+
return ex_expr::EXPR_ERROR;
};
// copy source to target
@@ -2540,6 +2589,10 @@ ex_expr::exp_return_type convAsciiFieldToInt64(Int64 &target,
{
// No digits were found
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
+ char hexstr[256];
+ if(*diagsArea)
+ **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
+
return ex_expr::EXPR_ERROR;
}
// return the number of digits read
@@ -3384,6 +3437,10 @@ ex_expr::exp_return_type convDecToInt64(Int64 &target,
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 ));
+
return ex_expr::EXPR_ERROR;
};
target *= 10;
@@ -3433,6 +3490,10 @@ ex_expr::exp_return_type convDecToDec(char *target,
// 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 ));
+
return ex_expr::EXPR_ERROR;
};
@@ -3440,6 +3501,10 @@ ex_expr::exp_return_type convDecToDec(char *target,
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 ));
+
return ex_expr::EXPR_ERROR;
};
str_cpy_all(target, &source[sourceIndex], targetLen);
@@ -4342,8 +4407,8 @@ unicodeToSByteTarget(
{
ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHAR_IN_TRANSLATE_FUNC);
char hexstr[256];
- memset(hexstr,0,256);
- *(*diagsArea) << DgString0("UNICODE") << DgString1("ISO88591") << DgString2(stringToHex(hexstr,256,source,sourceLen));
+ if(*diagsArea)
+ *(*diagsArea) << DgString0("UNICODE") << DgString1("ISO88591") << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
retcode = ex_expr::EXPR_ERROR;
}
}
@@ -4440,11 +4505,12 @@ unicodeToMByteTarget(
{
ExRaiseSqlError(heap, diagsArea, EXE_INVALID_CHAR_IN_TRANSLATE_FUNC);
char hexstr[256];
- memset(hexstr,0,256);
- if ( targetScale == SQLCHARSETCODE_UTF8 )
- *(*diagsArea) << DgString0("UNICODE") << DgString1("UTF8") << DgString2(stringToHex(hexstr,256,source,sourceLen));
- else
- *(*diagsArea) << DgString0("UNICODE") << DgString1("SJIS") << DgString2(stringToHex(hexstr,256,source,sourceLen));
+ if( *diagsArea ) {
+ if ( targetScale == SQLCHARSETCODE_UTF8 )
+ *(*diagsArea) << DgString0("UNICODE") << DgString1("UTF8") << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
+ else
+ *(*diagsArea) << DgString0("UNICODE") << DgString1("SJIS") << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
+ }
retcode = ex_expr::EXPR_ERROR;
// LCOV_EXCL_STOP
}
@@ -4578,8 +4644,8 @@ ex_expr::exp_return_type convCharToChar(
if(errCode == EXE_INVALID_CHAR_IN_TRANSLATE_FUNC)
{
char hexstr[256];
- memset(hexstr,0,256);
- *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,256,source,sourceLen));
+ if( *diagsArea )
+ *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
}
if (intermediateStr && intermediateStr != stackBuffer)
NADELETEBASIC(intermediateStr, heap);
@@ -4721,8 +4787,8 @@ ex_expr::exp_return_type convCharToChar(
if(errCode == EXE_INVALID_CHAR_IN_TRANSLATE_FUNC)
{
char hexstr[256];
- memset(hexstr,0,256);
- *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,256,source,sourceLen));
+ if( *diagsArea )
+ *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
}
if (intermediateStr && intermediateStr != stackBuffer)
NADELETEBASIC(intermediateStr, heap);
@@ -4767,8 +4833,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];
- memset(hexstr,0,256);
- *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,256,source,sourceLen));
+ if( *diagsArea )
+ *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
return ex_expr::EXPR_ERROR;
}
}
@@ -4795,8 +4861,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];
- memset(hexstr,0,256);
- *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,256,source,sourceLen));
+ if( *diagsArea )
+ *(*diagsArea) << DgString0(scaleToString(sourceScale)) << DgString1(scaleToString(targetScale)) << DgString2(stringToHex(hexstr,sizeof(hexstr),source,sourceLen));
return ex_expr::EXPR_ERROR;
}
@@ -8585,6 +8651,10 @@ convDoIt(char * source,
} else {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ if( *diagsArea )
+ **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
+
ok = ex_expr::EXPR_ERROR;
}
@@ -8670,6 +8740,9 @@ 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 ));
ok = ex_expr::EXPR_ERROR;
}
@@ -9025,6 +9098,10 @@ 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 ));
+
ok = ex_expr::EXPR_ERROR;
}
@@ -9099,6 +9176,10 @@ convDoIt(char * source,
}
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_STRING_ERROR);
+ char hexstr[256];
+ if( *diagsArea )
+ **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
+
return ex_expr::EXPR_ERROR;
};
break;
@@ -9259,6 +9340,10 @@ convDoIt(char * source,
}
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ if( *diagsArea )
+ **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
+
return ex_expr::EXPR_ERROR;
};
@@ -9299,6 +9384,9 @@ convDoIt(char * source,
}
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ if( *diagsArea )
+ **diagsArea << DgString0(stringToHex(hexstr, sizeof(hexstr), source, sourceLen ));
return ex_expr::EXPR_ERROR;
};
break;
@@ -9402,6 +9490,10 @@ convDoIt(char * source,
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 ));
+
return ex_expr::EXPR_ERROR;
// LCOV_EXCL_STOP
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/exp/exp_datetime.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_datetime.cpp b/core/sql/exp/exp_datetime.cpp
index 724bdb9..952fba0 100644
--- a/core/sql/exp/exp_datetime.cpp
+++ b/core/sql/exp/exp_datetime.cpp
@@ -1752,6 +1752,30 @@ 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.
@@ -1908,6 +1932,11 @@ scanField(char *&src,
// 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));
+
return FALSE;
}
} else if (src < srcEnd && isDigit8859_1(*src)) {
@@ -1939,7 +1968,8 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
{
NABoolean noDatetimeValidation = (flags & CONV_NO_DATETIME_VALIDATION) != 0;
-
+ Lng32 originalSrcLen = srcLen;
+ char * originalSrcData = srcData;
// skip leading and trailing blanks and adjust srcData and srcLen
// accordingly
//
@@ -1954,6 +1984,8 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
// string contains only blanks.
//
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ if(*diagsArea != NULL)
+ **diagsArea << DgString0("(string contains only blanks)");
return -1;
};
@@ -2019,6 +2051,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
//
if (format == DATETIME_FORMAT_ERROR) {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
@@ -2055,6 +2095,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
if ((defZ || TZD) && (dstEndField == REC_DATE_DAY))
{
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
@@ -2151,6 +2199,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
diagsArea,
flags)) {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
}
@@ -2159,6 +2215,14 @@ 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];
+ 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);
return -1;
}
@@ -2170,6 +2234,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
usaAmPm) {
if (datetimeValues[REC_DATE_HOUR] > 12) {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
@@ -2190,6 +2262,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
}
} else if (usaAmPm) {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
@@ -2240,6 +2320,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
break;
default:
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
}
@@ -2253,6 +2341,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
dstData, NULL, FALSE,
LastDayPrevMonth)) {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
};
@@ -2269,6 +2365,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
Int64 juliantimestamp = COMPUTETIMESTAMP(timestamp, &error);
if (error) {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
@@ -2317,6 +2421,14 @@ ExpDatetime::convAsciiToDatetime(char *srcData,
break;
default:
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
}
@@ -2358,6 +2470,8 @@ static NABoolean convertStrToMonth(char* &srcData, char *result,
const char * nextByte,
CollHeap * heap, ComDiagsArea** diagsArea)
{
+ int copyLen = strlen(srcData);
+ char * originalSrcData = srcData;
const char * months[] =
{
"JAN",
@@ -2390,6 +2504,13 @@ static NABoolean convertStrToMonth(char* &srcData, char *result,
{
// string contains non-digit
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ memset(hexstr, 0 , sizeof(hexstr) );
+ if(copyLen > sizeof(hexstr) -1 )
+ copyLen = sizeof(hexstr) -1;
+ strncpy(hexstr,originalSrcData,copyLen);
+ if(*diagsArea != NULL)
+ **diagsArea << DgString0(hexstr);
return FALSE; // error
}
srcData++;
@@ -2454,6 +2575,14 @@ static short convSrcDataToDst(Lng32 numSrcBytes, char* &srcData,
// string contains non-digit
//
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
@@ -2472,6 +2601,14 @@ static short convSrcDataToDst(Lng32 numSrcBytes, char* &srcData,
{
// string contains non-digit
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
@@ -2535,6 +2672,14 @@ ExpDatetime::convAsciiToDate(char *srcData,
// string contains only blanks.
//
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
};
@@ -2554,6 +2699,14 @@ ExpDatetime::convAsciiToDate(char *srcData,
// string doesn't seem to contain all date fields.
//
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
};
@@ -2765,6 +2918,14 @@ ExpDatetime::convAsciiToDate(char *srcData,
char * prevSrcData = srcData;
if (! convertStrToMonthLongFormat(srcData, &dstData[2])) {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
minLength += (srcData - prevSrcData);
@@ -2932,6 +3093,14 @@ ExpDatetime::convAsciiToDate(char *srcData,
// Format could not be determined, issue an error.
//
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
};
@@ -2945,6 +3114,14 @@ ExpDatetime::convAsciiToDate(char *srcData,
// string contains only blanks.
//
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
}
@@ -2959,6 +3136,14 @@ ExpDatetime::convAsciiToDate(char *srcData,
dstData, NULL, FALSE,
LastDayPrevMonth)) {
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
};
}
@@ -3553,6 +3738,14 @@ ExpDatetime::convNumericTimeToASCII(char *srcData,
if (format == DATETIME_FORMAT_NUM1)
{
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
@@ -3591,6 +3784,14 @@ ExpDatetime::convNumericTimeToASCII(char *srcData,
if (temp > 0)
{
ExRaiseSqlError(heap, diagsArea, EXE_CONVERT_DATETIME_ERROR);
+ char hexstr[256];
+ 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);
return -1;
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index 4e3211d..d9cda1f 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -44,6 +44,7 @@
#include <ctype.h>
#include <string.h>
+#include <stdio.h>
#include "NLSConversion.h"
#include "nawstring.h"
@@ -2498,9 +2499,19 @@ ex_expr::exp_return_type ex_function_converttimestamp::eval(char *op_data[],
(Int64) 99999999;
if ((juliantimestamp < minJuliantimestamp) ||
(juliantimestamp > maxJuliantimestamp)) {
- ExRaiseFunctionSqlError(heap, diagsArea, EXE_CONVERTTIMESTAMP_ERROR,
- derivedFunction(),
- origFunctionOperType());
+ char tmpbuf[24];
+ memset(tmpbuf, 0, sizeof(tmpbuf) );
+ sprintf(tmpbuf, "%ld", juliantimestamp);
+
+ ExRaiseSqlError(heap, diagsArea, EXE_CONVERTTIMESTAMP_ERROR);
+ if(*diagsArea)
+ **diagsArea << DgString0(tmpbuf);
+
+ if(derivedFunction())
+ {
+ **diagsArea << DgSqlCode(-EXE_MAPPED_FUNCTION_ERROR);
+ **diagsArea << DgString0(exClauseGetText(origFunctionOperType()));
+ }
return ex_expr::EXPR_ERROR;
}
@@ -2840,9 +2851,19 @@ ex_expr::exp_return_type ex_function_juliantimestamp::eval(char *op_data[],
short error;
juliantimestamp = COMPUTETIMESTAMP(timestamp, &error);
if (error) {
- ExRaiseFunctionSqlError(heap, diagsArea, EXE_JULIANTIMESTAMP_ERROR,
- derivedFunction(),
- origFunctionOperType());
+ char tmpbuf[24];
+ memset(tmpbuf, 0, sizeof(tmpbuf) );
+ sprintf(tmpbuf, "%ld", juliantimestamp);
+
+ ExRaiseSqlError(heap, diagsArea, EXE_JULIANTIMESTAMP_ERROR);
+ if(*diagsArea)
+ **diagsArea << DgString0(tmpbuf);
+
+ if(derivedFunction())
+ {
+ **diagsArea << DgSqlCode(-EXE_MAPPED_FUNCTION_ERROR);
+ **diagsArea << DgString0(exClauseGetText(origFunctionOperType()));
+ }
return ex_expr::EXPR_ERROR;
}
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/regress/core/EXPECTED038.LINUX
----------------------------------------------------------------------
diff --git a/core/sql/regress/core/EXPECTED038.LINUX b/core/sql/regress/core/EXPECTED038.LINUX
index 27eb294..8bb083a 100644
--- a/core/sql/regress/core/EXPECTED038.LINUX
+++ b/core/sql/regress/core/EXPECTED038.LINUX
@@ -2748,7 +2748,7 @@ B1
--- 0 row(s) selected.
>>select * from T038b where b1 < cast('1997-28-02' as DATE) + interval '2' day;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 1997-28-02
--- 0 row(s) selected.
>>
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/regress/executor/EXPECTED022.SB
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/EXPECTED022.SB b/core/sql/regress/executor/EXPECTED022.SB
index cbe4b2f..4c448c1 100644
--- a/core/sql/regress/executor/EXPECTED022.SB
+++ b/core/sql/regress/executor/EXPECTED022.SB
@@ -786,17 +786,17 @@ A B C
>>-- negative cases
>>select cast('2016-01-29Z' as date) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 2016-01-29Z
--- 0 row(s) selected.
>>select cast('2016-01-29+05:00' as date) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 2016-01-29+05:00
--- 0 row(s) selected.
>>select cast('10:11:12-05:000' as time) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 10:11:12-05:000
--- 0 row(s) selected.
>>select date '2016-01-29Z' from t022t1;
@@ -825,17 +825,17 @@ A B C
>>select cast ('23:11:61' as time) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 23:11:61-05:000
--- 0 row(s) selected.
>>select cast ('23:11:06' as timestamp) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 23:11:06
--- 0 row(s) selected.
>>select cast('2010-01-01' as time) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 2010-01-015:000
--- 0 row(s) selected.
>>select timestamp'2010-01-01 10' from t022t1;
@@ -2348,28 +2348,28 @@ Hello
>>-- illegal european format
>>select cast ('12.13.1987' as date) from t022t2;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 12.13.1987
--- 0 row(s) selected.
>>
>>-- illegal US format
>>select cast ('13/12/1987' as date) from t022t2;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 13/12/1987
--- 0 row(s) selected.
>>
>>-- string overflow
>>select cast (cast ('12.07.1961 03:04:55.123456' as timestamp) as char(18)) from t022t2;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 12.07.1961 03:04:55.123456
--- 0 row(s) selected.
>>
>>-- Feb. 30th doesn't exist
>>select cast('1997-30-02' as DATE) from t022t2;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 1997-30-02
--- 0 row(s) selected.
>>
@@ -2718,7 +2718,7 @@ A B
>>set param ?p '11/20/1997 15:15:08.123456 am';
>>insert into t022t8 (c1) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 11/20/1997 15:15:08.123456 am
*** ERROR[15015] PARAM ?p (value 11/20/1997 15:15:08.123456 am) cannot be converted to type TIMESTAMP(6).
@@ -2728,9 +2728,9 @@ A B
>>set param ?p '2100-01-01:ab:00:47.250000';
>>insert into t022t8 (c1) values ( ?p );
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 61623a30303a34372e323530303030
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 2100-01-01:ab:00:47.250000
*** ERROR[15015] PARAM ?p (value 2100-01-01:ab:00:47.250000) cannot be converted to type TIMESTAMP(6).
@@ -2740,7 +2740,7 @@ A B
>>set param ?p '1998-03-12 03:15:08.123456 pm';
>>insert into t022t8 (c1) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 1998-03-12 03:15:08.123456 pm
*** ERROR[15015] PARAM ?p (value 1998-03-12 03:15:08.123456 pm) cannot be converted to type TIMESTAMP(6).
@@ -2750,7 +2750,7 @@ A B
>>set param ?p '1996-05-23 16:15:08.123 am';
>>insert into t022t8 (c1) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 1996-05-23 16:15:08.123 am
*** ERROR[15015] PARAM ?p (value 1996-05-23 16:15:08.123 am) cannot be converted to type TIMESTAMP(6).
@@ -2823,9 +2823,9 @@ C1
>>set param ?p '00:a1:00';
>>insert into t022t8 (c2) values ( ?p );
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 61313a3030
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 00:a1:00
*** ERROR[15015] PARAM ?p (value 00:a1:00) cannot be converted to type TIME(0).
@@ -2835,7 +2835,7 @@ C1
>>set param ?p '14:59:59 am';
>>insert into t022t8 (c2) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 14:59:59 am
*** ERROR[15015] PARAM ?p (value 14:59:59 am) cannot be converted to type TIME(0).
@@ -2845,7 +2845,7 @@ C1
>>set param ?p '11:60:59 am';
>>insert into t022t8 (c2) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 11:60:59 am
*** ERROR[15015] PARAM ?p (value 11:60:59 am) cannot be converted to type TIME(0).
@@ -3009,64 +3009,64 @@ C1 C2
>>-- negative cases (expect errors)
>>select cast('.-2' as int) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e2d32
--- 0 row(s) selected.
>>select cast('.+3' as int) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e2b33
--- 0 row(s) selected.
>>select cast('.4-' as numeric(4)) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e342d
--- 0 row(s) selected.
>>select cast('-. 3' as int) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2d2e2033
--- 0 row(s) selected.
>>select cast('-3 . ' as int) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2d33202e20
--- 0 row(s) selected.
>>
>>select c1 from t022t8 where cast('.-2' as int) < 1000;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e2d32
--- 0 row(s) selected.
>>select c1 from t022t8 where cast('.+3' as int) < 1000;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e2b33
--- 0 row(s) selected.
>>select c1 from t022t8 where cast('.4-' as numeric(4)) < 1;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e342d
--- 0 row(s) selected.
>>select c1 from t022t8 where cast('-. 3' as int) < 1;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2d2e2033
--- 0 row(s) selected.
>>select c1 from t022t8 where cast('-3 .' as int) < 1;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2d33202e
--- 0 row(s) selected.
>>
>>select cast ('123..' as real) from (values(1)) as T;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 3132332e2e
--- 0 row(s) selected.
>>select cast ('123..12' as real)from (values(1)) as T;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 3132332e2e3132
--- 0 row(s) selected.
>>
@@ -3699,14 +3699,14 @@ Hello
>>-- illegal european format
>>select cast (N'12.13.1987' as date) from t022u;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 12.13.1987
--- 0 row(s) selected.
>>
>>-- illegal US format
>>select cast (N'13/12/1987' as date) from t022u;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 13/12/1987
--- 0 row(s) selected.
>>
@@ -3721,7 +3721,7 @@ Hello
>>-- Feb. 32th doesn't exist
>>select cast(N'1997-02-32' as DATE) from t022u;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 1997-02-32
--- 0 row(s) selected.
>>
@@ -3935,7 +3935,7 @@ Hello
>>-- negative test on cast VAR/NCAR to DEC
>>select cast(N'1009a' as DEC) from t022u;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 3130303961
--- 0 row(s) selected.
>>
@@ -3973,17 +3973,17 @@ Hello
>>-- negative test on cast VAR/NCAR to float/real/double
>>select cast(N'this is not a number.' as float) from t022u;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 74686973206973206e6f742061206e756d6265722e
--- 0 row(s) selected.
>>select cast(N'1023u' as real) from t022u;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 3130323375
--- 0 row(s) selected.
>>select cast(N'''\2' as double precision) from t022u;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 275c32
--- 0 row(s) selected.
>>?ifNT
@@ -5519,17 +5519,17 @@ A B C
>>-- negative cases
>>select cast('2016-01-29Z' as date) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 2016-01-29Z
--- 0 row(s) selected.
>>select cast('2016-01-29+05:00' as date) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 2016-01-29+05:00
--- 0 row(s) selected.
>>select cast('10:11:12-05:000' as time) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 10:11:12-05:000
--- 0 row(s) selected.
>>select date '2016-01-29Z' from t022t1;
@@ -5558,17 +5558,17 @@ A B C
>>select cast ('23:11:61' as time) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 23:11:61-05:000
--- 0 row(s) selected.
>>select cast ('23:11:06' as timestamp) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 23:11:06
--- 0 row(s) selected.
>>select cast('2010-01-01' as time) from t022t1;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 2010-01-015:000
--- 0 row(s) selected.
>>select timestamp'2010-01-01 10' from t022t1;
@@ -7081,28 +7081,28 @@ Hello
>>-- illegal european format
>>select cast ('12.13.1987' as date) from t022t2;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 12.13.1987
--- 0 row(s) selected.
>>
>>-- illegal US format
>>select cast ('13/12/1987' as date) from t022t2;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 13/12/1987
--- 0 row(s) selected.
>>
>>-- string overflow
>>select cast (cast ('12.07.1961 03:04:55.123456' as timestamp) as char(18)) from t022t2;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 12.07.1961 03:04:55.123456
--- 0 row(s) selected.
>>
>>-- Feb. 30th doesn't exist
>>select cast('1997-30-02' as DATE) from t022t2;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 1997-30-02
--- 0 row(s) selected.
>>
@@ -7451,7 +7451,7 @@ A B
>>set param ?p '11/20/1997 15:15:08.123456 am';
>>insert into t022t8 (c1) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 11/20/1997 15:15:08.123456 am
*** ERROR[15015] PARAM ?p (value 11/20/1997 15:15:08.123456 am) cannot be converted to type TIMESTAMP(6).
@@ -7461,9 +7461,9 @@ A B
>>set param ?p '2100-01-01:ab:00:47.250000';
>>insert into t022t8 (c1) values ( ?p );
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 61623a30303a34372e323530303030
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 2100-01-01:ab:00:47.250000
*** ERROR[15015] PARAM ?p (value 2100-01-01:ab:00:47.250000) cannot be converted to type TIMESTAMP(6).
@@ -7473,7 +7473,7 @@ A B
>>set param ?p '1998-03-12 03:15:08.123456 pm';
>>insert into t022t8 (c1) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 1998-03-12 03:15:08.123456 pm
*** ERROR[15015] PARAM ?p (value 1998-03-12 03:15:08.123456 pm) cannot be converted to type TIMESTAMP(6).
@@ -7483,7 +7483,7 @@ A B
>>set param ?p '1996-05-23 16:15:08.123 am';
>>insert into t022t8 (c1) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 1996-05-23 16:15:08.123 am
*** ERROR[15015] PARAM ?p (value 1996-05-23 16:15:08.123 am) cannot be converted to type TIMESTAMP(6).
@@ -7556,9 +7556,9 @@ C1
>>set param ?p '00:a1:00';
>>insert into t022t8 (c2) values ( ?p );
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 61313a3030
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 00:a1:00
*** ERROR[15015] PARAM ?p (value 00:a1:00) cannot be converted to type TIME(0).
@@ -7568,7 +7568,7 @@ C1
>>set param ?p '14:59:59 am';
>>insert into t022t8 (c2) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 14:59:59 am
*** ERROR[15015] PARAM ?p (value 14:59:59 am) cannot be converted to type TIME(0).
@@ -7578,7 +7578,7 @@ C1
>>set param ?p '11:60:59 am';
>>insert into t022t8 (c2) values ( ?p );
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 11:60:59 am
*** ERROR[15015] PARAM ?p (value 11:60:59 am) cannot be converted to type TIME(0).
@@ -7742,64 +7742,64 @@ C1 C2
>>-- negative cases (expect errors)
>>select cast('.-2' as int) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e2d32
--- 0 row(s) selected.
>>select cast('.+3' as int) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e2b33
--- 0 row(s) selected.
>>select cast('.4-' as numeric(4)) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e342d
--- 0 row(s) selected.
>>select cast('-. 3' as int) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2d2e2033
--- 0 row(s) selected.
>>select cast('-3 . ' as int) from t022t8;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2d33202e20
--- 0 row(s) selected.
>>
>>select c1 from t022t8 where cast('.-2' as int) < 1000;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e2d32
--- 0 row(s) selected.
>>select c1 from t022t8 where cast('.+3' as int) < 1000;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e2b33
--- 0 row(s) selected.
>>select c1 from t022t8 where cast('.4-' as numeric(4)) < 1;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2e342d
--- 0 row(s) selected.
>>select c1 from t022t8 where cast('-. 3' as int) < 1;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2d2e2033
--- 0 row(s) selected.
>>select c1 from t022t8 where cast('-3 .' as int) < 1;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 2d33202e
--- 0 row(s) selected.
>>
>>select cast ('123..' as real) from (values(1)) as T;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 3132332e2e
--- 0 row(s) selected.
>>select cast ('123..12' as real)from (values(1)) as T;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 3132332e2e3132
--- 0 row(s) selected.
>>
@@ -8432,14 +8432,14 @@ Hello
>>-- illegal european format
>>select cast (N'12.13.1987' as date) from t022u;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 12.13.1987
--- 0 row(s) selected.
>>
>>-- illegal US format
>>select cast (N'13/12/1987' as date) from t022u;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 13/12/1987
--- 0 row(s) selected.
>>
@@ -8454,7 +8454,7 @@ Hello
>>-- Feb. 32th doesn't exist
>>select cast(N'1997-02-32' as DATE) from t022u;
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 1997-02-32
--- 0 row(s) selected.
>>
@@ -8668,7 +8668,7 @@ Hello
>>-- negative test on cast VAR/NCAR to DEC
>>select cast(N'1009a' as DEC) from t022u;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 3130303961
--- 0 row(s) selected.
>>
@@ -8706,17 +8706,17 @@ Hello
>>-- negative test on cast VAR/NCAR to float/real/double
>>select cast(N'this is not a number.' as float) from t022u;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 74686973206973206e6f742061206e756d6265722e
--- 0 row(s) selected.
>>select cast(N'1023u' as real) from t022u;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 3130323375
--- 0 row(s) selected.
>>select cast(N'''\2' as double precision) from t022u;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 275c32
--- 0 row(s) selected.
>>?ifNT
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/regress/executor/EXPECTED050
----------------------------------------------------------------------
diff --git a/core/sql/regress/executor/EXPECTED050 b/core/sql/regress/executor/EXPECTED050
index 2b49aad..43b9571 100755
--- a/core/sql/regress/executor/EXPECTED050
+++ b/core/sql/regress/executor/EXPECTED050
@@ -135,7 +135,7 @@
>>set param ?ee e;
>>select * from T050a where d=?ee;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 65
*** ERROR[15015] PARAM ?ee (value e) cannot be converted to type NUMERIC(18, 6).
@@ -235,7 +235,7 @@ PARAM ?c aa
PARAM ?d foo
>>execute x using 77;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 666f6f
*** ERROR[15015] PARAM ?d (value foo) cannot be converted to type NUMERIC(18, 6).
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/regress/hive/EXPECTED005
----------------------------------------------------------------------
diff --git a/core/sql/regress/hive/EXPECTED005 b/core/sql/regress/hive/EXPECTED005
index 0c505e3..e44c6d3 100644
--- a/core/sql/regress/hive/EXPECTED005
+++ b/core/sql/regress/hive/EXPECTED005
@@ -509,7 +509,7 @@ C1 C2 C3 C4
--- SQL operation complete.
>>load with NO OUTPUT into trafodion.seabase.tbl_dos_num select * from tbl_dos_num;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 33393437380d
--- 0 row(s) loaded.
>>cqd HIVE_SCAN_SPECIAL_MODE '1';
@@ -540,7 +540,7 @@ C1 C2
--- SQL operation complete.
>>select * from tbl_bad;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 61
--- 0 row(s) selected.
>>cqd HIVE_SCAN_SPECIAL_MODE '2';
@@ -581,17 +581,17 @@ C1 C2 C3 C4 C
--- SQL operation complete.
>>load with no output into trafodion.seabase.traf_tbl_bad select * from tbl_bad;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 61
--- 0 row(s) loaded.
>>insert into trafodion.seabase.traf_tbl_bad select * from tbl_bad;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 61
--- 0 row(s) inserted.
>>upsert into trafodion.seabase.traf_tbl_bad select * from tbl_bad;
-*** ERROR[8413] The string argument contains characters that cannot be converted.
+*** ERROR[8413] The string argument contains characters that cannot be converted. Source data 61
--- 0 row(s) inserted.
>>cqd HIVE_SCAN_SPECIAL_MODE '2';
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/5b8eba55/core/sql/regress/seabase/EXPECTED030
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED030 b/core/sql/regress/seabase/EXPECTED030
index ebdc227..2376f64 100644
--- a/core/sql/regress/seabase/EXPECTED030
+++ b/core/sql/regress/seabase/EXPECTED030
@@ -549,7 +549,7 @@ March 01, 2016, 10:11:12
>>select to_date('0103.2016', 'DD.MM.YYYY') from (values(1)) x(a);
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data 0103.2016
--- 0 row(s) selected.
>>select to_char('2016-03-01', 'YYYY-MM-DD') from (values(1)) x(a);
@@ -603,14 +603,14 @@ March 01, 2016, 10:11:12
>>-- ms4 error cases
>>select to_date(123456789, '99:99:99:99') from (values(1)) x(a);
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data ?
*** ERROR[8001] An internal executor error occurred.
--- 0 row(s) selected.
>>select to_date(-12345678, '99:99:99:99') from (values(1)) x(a);
-*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+*** ERROR[8415] The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data ?
*** ERROR[8001] An internal executor error occurred.
[5/5] incubator-trafodion git commit: Merge [TRAFODION-1676] PR-564
support better runtime error message when a SQL function meet fital error
Posted by su...@apache.org.
Merge [TRAFODION-1676] PR-564 support better runtime error message when a SQL function meet fital error
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/d3de6851
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/d3de6851
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/d3de6851
Branch: refs/heads/master
Commit: d3de6851ac644385e3a1ed0f94cc4c8cf0c80f21
Parents: f1b85ee bb50c5a
Author: Suresh Subbiah <su...@apache.org>
Authored: Tue Jul 5 13:27:59 2016 +0000
Committer: Suresh Subbiah <su...@apache.org>
Committed: Tue Jul 5 13:27:59 2016 +0000
----------------------------------------------------------------------
core/sql/bin/SqlciErrors.txt | 4 +-
core/sql/cli/Statement.cpp | 4 +
core/sql/exp/ExpError.cpp | 25 ++++
core/sql/exp/ExpError.h | 5 +
core/sql/exp/exp_conv.cpp | 153 ++++++++++++----------
core/sql/exp/exp_datetime.cpp | 178 ++++++++++++++++++++++----
core/sql/exp/exp_function.cpp | 33 ++++-
core/sql/regress/core/EXPECTED038.LINUX | 2 +-
core/sql/regress/executor/EXPECTED022.SB | 152 +++++++++++-----------
core/sql/regress/executor/EXPECTED050 | 4 +-
core/sql/regress/hive/EXPECTED005 | 10 +-
core/sql/regress/seabase/EXPECTED030 | 6 +-
12 files changed, 389 insertions(+), 187 deletions(-)
----------------------------------------------------------------------
[2/5] incubator-trafodion git commit: fix to code review comments
Posted by su...@apache.org.
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 <ov...@sina.com>
Authored: Thu Jun 30 01:43:28 2016 +0000
Committer: Liu Ming <ov...@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;
}
[3/5] incubator-trafodion git commit: fix potential string overflow
issue
Posted by su...@apache.org.
fix potential string overflow issue
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/bfff5350
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/bfff5350
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/bfff5350
Branch: refs/heads/master
Commit: bfff53505dd810a260a7fafb50b5dd716e5c8fbe
Parents: c234376
Author: Liu Ming <ov...@sina.com>
Authored: Fri Jul 1 00:28:47 2016 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Fri Jul 1 00:28:47 2016 +0000
----------------------------------------------------------------------
core/sql/exp/ExpError.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bfff5350/core/sql/exp/ExpError.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpError.cpp b/core/sql/exp/ExpError.cpp
index fbfb55b..8a79d91 100644
--- a/core/sql/exp/ExpError.cpp
+++ b/core/sql/exp/ExpError.cpp
@@ -628,7 +628,7 @@ char *stringToHex(char * out, Int32 outLen, char * in, Int32 inLen)
//clear out buffer first
memset(out,0,outLen);
- outLen = (outLen / 2) ;
+ outLen = (outLen / 2) -1 ;
if(inLen < outLen) outLen = inLen;
[4/5] incubator-trafodion git commit: Merge branch 'master' of
git://git.apache.org/incubator-trafodion into TRAFODION-2046-1
Posted by su...@apache.org.
Merge branch 'master' of git://git.apache.org/incubator-trafodion into TRAFODION-2046-1
Conflicts:
core/sql/bin/SqlciErrors.txt
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/bb50c5aa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/bb50c5aa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/bb50c5aa
Branch: refs/heads/master
Commit: bb50c5aa97efc4ffba781cce06584da980bd4516
Parents: bfff535 5f77bd2
Author: Liu Ming <ov...@sina.com>
Authored: Fri Jul 1 16:09:50 2016 +0000
Committer: Liu Ming <ov...@sina.com>
Committed: Fri Jul 1 16:09:50 2016 +0000
----------------------------------------------------------------------
.../main/java/org/trafodion/jdbc/t4/Bytes.java | 5 +
.../trafodion/jdbc/t4/InterfaceResultSet.java | 29 +-
.../trafodion/jdbc/t4/InterfaceStatement.java | 25 +
.../trafodion/jdbc/t4/InterfaceUtilities.java | 11 +-
.../java/org/trafodion/jdbc/t4/TrafT4Desc.java | 4 +-
.../jdbc/t4/TrafT4PreparedStatement.java | 2 +-
.../java/org/trafodion/jdbc/t4/Utility.java | 12 +-
core/conn/jdbc_type2/Makefile | 2 +-
.../odbc/src/odbc/nsksrvrcore/sqlinterface.cpp | 96 +-
.../odbc/src/odbc/nsksrvrcore/srvrothers.cpp | 78 +
core/dbsecurity/auth/src/ldapcheck.cpp | 2 +
core/sqf/sql/scripts/krb5check | 133 ++
core/sqf/sql/scripts/krb5functions | 128 ++
core/sqf/sql/scripts/krb5service | 255 ++++
core/sqf/sql/scripts/sqcheck | 68 +-
core/sqf/sql/scripts/sqstart | 37 +
core/sql/bin/SqlciErrors.txt | 9 +-
core/sql/cli/Cli.cpp | 1 +
core/sql/cli/CliExpExchange.cpp | 29 +-
core/sql/cli/Descriptor.cpp | 16 +-
core/sql/cli/sqlcli.h | 5 +
core/sql/comexe/ComTdb.cpp | 59 +-
core/sql/comexe/ComTdb.h | 28 +-
core/sql/comexe/ComTdbExeUtil.cpp | 137 +-
core/sql/comexe/ComTdbExeUtil.h | 123 +-
core/sql/comexe/ComTdbFastTransport.h | 8 +-
core/sql/common/BaseTypes.cpp | 85 +-
core/sql/common/BigNumHelper.cpp | 27 +-
core/sql/common/BigNumHelper.h | 6 +-
core/sql/common/CharType.cpp | 6 +-
core/sql/common/CharType.h | 10 +-
core/sql/common/ComSmallDefs.h | 16 +-
core/sql/common/ComSysUtils.h | 21 +
core/sql/common/Int64.cpp | 20 +
core/sql/common/Int64.h | 12 +
core/sql/common/NAType.cpp | 93 +-
core/sql/common/NAType.h | 7 +
core/sql/common/NumericType.cpp | 319 ++--
core/sql/common/NumericType.h | 226 +--
core/sql/common/OperTypeEnum.h | 1 +
core/sql/common/SQLTypeDefs.h | 6 +
core/sql/common/dfs2rec.h | 9 +-
core/sql/executor/ExComTdb.cpp | 9 +-
core/sql/executor/ExExeUtil.h | 61 +-
core/sql/executor/ExExeUtilMisc.cpp | 68 +-
core/sql/executor/ExFastTransport.cpp | 16 +-
core/sql/executor/ExHbaseAccess.cpp | 26 +
core/sql/executor/ExHbaseIUD.cpp | 6 +-
core/sql/exp/ExpAlignedFormat.h | 10 +-
core/sql/exp/ExpErrorEnums.h | 4 +-
core/sql/exp/ExpHbaseInterface.h | 16 -
core/sql/exp/ExpLOBaccess.cpp | 81 +-
core/sql/exp/ExpLOBaccess.h | 3 +-
core/sql/exp/ExpPCodeClauseGen.cpp | 2 -
core/sql/exp/ExpPCodeOptsConstProp.cpp | 2 +-
core/sql/exp/exp_arith.cpp | 99 +-
core/sql/exp/exp_attrs.cpp | 5 +-
core/sql/exp/exp_bignum.cpp | 12 +-
core/sql/exp/exp_clause_derived.h | 53 +-
core/sql/exp/exp_comp.cpp | 170 ++-
core/sql/exp/exp_conv.cpp | 1369 +++++++++++++----
core/sql/exp/exp_fixup.cpp | 82 +-
core/sql/exp/exp_function.cpp | 178 +--
core/sql/exp/exp_math_func.cpp | 107 +-
core/sql/exp/exp_tuple_desc.h | 2 +-
core/sql/generator/GenFastTransport.cpp | 74 +-
core/sql/generator/GenPreCode.cpp | 290 ++--
core/sql/generator/GenRelExeUtil.cpp | 112 +-
core/sql/generator/GenRelScan.cpp | 59 +-
core/sql/generator/Generator.cpp | 3 +-
core/sql/langman/LmJavaType.cpp | 21 +-
core/sql/langman/LmJavaType.h | 1 +
core/sql/langman/LmResultSetJava.cpp | 56 +-
core/sql/langman/LmRoutineCSql.cpp | 27 +
core/sql/optimizer/BindRelExpr.cpp | 202 +--
core/sql/optimizer/BindWA.cpp | 3 +-
core/sql/optimizer/BindWA.h | 37 +-
core/sql/optimizer/EncodedValue.cpp | 16 +-
core/sql/optimizer/ItemExpr.cpp | 33 +-
core/sql/optimizer/ItemFunc.h | 64 +-
core/sql/optimizer/NAColumn.cpp | 82 +-
core/sql/optimizer/NAColumn.h | 3 +
core/sql/optimizer/NAFileSet.h | 2 +
core/sql/optimizer/NATable.cpp | 199 ++-
core/sql/optimizer/NATable.h | 25 +-
core/sql/optimizer/OptPhysRelExpr.cpp | 31 +-
core/sql/optimizer/OptRange.cpp | 2 -
core/sql/optimizer/RelExeUtil.cpp | 214 +--
core/sql/optimizer/RelExeUtil.h | 94 +-
core/sql/optimizer/SynthType.cpp | 11 +-
core/sql/optimizer/ValueDesc.cpp | 91 +-
core/sql/parser/ElemDDLLike.cpp | 4 +-
core/sql/parser/ElemDDLLikeCreateTable.h | 6 +-
core/sql/parser/ElemDDLLikeOptions.cpp | 25 +
core/sql/parser/ElemDDLLikeOptions.h | 34 +
core/sql/parser/ElemDDLNode.cpp | 32 +
core/sql/parser/ElemDDLNode.h | 2 +
core/sql/parser/ElemDDLSaltOptions.h | 2 +
core/sql/parser/ParDDLLikeOpts.cpp | 45 +
core/sql/parser/ParDDLLikeOptsCreateTable.h | 8 +
core/sql/parser/ParKeyWords.cpp | 3 -
core/sql/parser/SqlParserAux.cpp | 20 +-
core/sql/parser/StmtDDLAlterLibrary.h | 14 +
core/sql/parser/StmtDDLCreate.cpp | 44 +-
core/sql/parser/sqlparser.y | 182 ++-
core/sql/regress/compGeneral/EXPECTED015.SB | 469 +++---
core/sql/regress/compGeneral/EXPECTED042 | 32 +-
core/sql/regress/core/EXPECTED116 | 125 +-
core/sql/regress/core/TEST116 | 37 +-
core/sql/regress/executor/EXPECTED022.SB | 246 +--
core/sql/regress/executor/EXPECTED063 | 166 +-
core/sql/regress/executor/EXPECTED140 | 60 +-
core/sql/regress/executor/TEST022 | 54 +-
core/sql/regress/hive/EXPECTED005 | 278 +++-
core/sql/regress/hive/EXPECTED009 | 1139 +++++++++++---
core/sql/regress/hive/FILTER009 | 49 +
core/sql/regress/hive/TEST005 | 101 +-
core/sql/regress/hive/TEST005_a.hive.sql | 7 +
core/sql/regress/hive/TEST009 | 93 +-
core/sql/regress/hive/TEST020 | 2 +-
core/sql/regress/hive/tbl_bad.data | 2 +-
core/sql/regress/hive/tbl_type.data | 2 +-
core/sql/regress/privs2/EXPECTED129 | 36 +-
core/sql/regress/qat/eqatdml12 | 98 +-
core/sql/regress/qat/eqatdml13 | 98 +-
core/sql/regress/seabase/EXPECTED003 | 1414 ++++++++++++++++++
core/sql/regress/seabase/EXPECTED011 | 16 +-
core/sql/regress/seabase/EXPECTED020 | 8 +-
core/sql/regress/seabase/EXPECTED031 | 237 +++
core/sql/regress/seabase/EXPECTED040 | 275 ++++
core/sql/regress/seabase/TEST003 | 237 +++
core/sql/regress/seabase/TEST011 | 2 +-
core/sql/regress/seabase/TEST031 | 53 +
core/sql/regress/seabase/TEST040 | 115 ++
core/sql/regress/udr/EXPECTED001 | 22 +-
core/sql/regress/udr/EXPECTED100.SB | 53 +-
core/sql/regress/udr/TEST001 | 5 +
core/sql/regress/udr/TEST100 | 13 +
core/sql/regress/udr/t100.java | 4 +
core/sql/sqlcat/desc.h | 3 +-
core/sql/sqlci/Formatter.cpp | 19 +-
core/sql/sqlci/Param.cpp | 5 +-
core/sql/sqlci/SqlciEnv.cpp | 29 +-
core/sql/sqlci/SqlciEnv.h | 2 +-
core/sql/sqlci/sqlci_lex.ll | 1 +
core/sql/sqlci/sqlci_yacc.y | 2 +
core/sql/sqlcomp/CmpDescribe.cpp | 300 ++--
core/sql/sqlcomp/CmpSeabaseDDL.h | 139 +-
core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 92 +-
core/sql/sqlcomp/CmpSeabaseDDLindex.cpp | 89 +-
core/sql/sqlcomp/CmpSeabaseDDLmd.h | 8 +
core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp | 137 +-
core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 174 ++-
core/sql/sqlcomp/DefaultConstants.h | 49 +-
core/sql/sqlcomp/DefaultValidator.cpp | 15 +
core/sql/sqlcomp/nadefaults.cpp | 107 +-
core/sql/ustat/hs_cli.cpp | 51 +-
core/sql/ustat/hs_faststats.cpp | 15 +-
core/sql/ustat/hs_globals.cpp | 155 +-
.../src/asciidoc/_chapters/parser_msgs.adoc | 13 +
.../src/asciidoc/_chapters/sqlstate.adoc | 1 +
.../src/asciidoc/_chapters/about.adoc | 6 +-
.../src/asciidoc/_chapters/activate.adoc | 1 +
.../src/asciidoc/_chapters/enable_security.adoc | 251 ++--
.../src/asciidoc/_chapters/introduction.adoc | 142 +-
.../src/asciidoc/_chapters/prepare.adoc | 41 +-
.../src/asciidoc/_chapters/requirements.adoc | 34 +-
.../src/asciidoc/_chapters/script_install.adoc | 13 +-
.../src/asciidoc/_chapters/script_upgrade.adoc | 14 +-
docs/shared/revisions.txt | 3 +-
.../src/asciidoc/_chapters/sql_statements.adoc | 51 +-
install/installer/traf_add_kerberos | 204 +++
install/installer/traf_add_ldap | 98 ++
install/installer/traf_cloudera_mods | 16 +
install/installer/traf_config_check | 2 +-
install/installer/traf_config_setup | 159 --
install/installer/traf_hortonworks_mods | 32 +-
install/installer/traf_secure | 60 +
install/installer/traf_secure_setup | 342 +++++
install/installer/traf_sqgen | 37 +-
install/installer/trafodion_config_default | 36 +-
install/installer/trafodion_install | 91 +-
install/installer/trafodion_secure_install | 129 ++
install/installer/trafodion_uninstaller | 20 +
184 files changed, 11858 insertions(+), 3598 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bb50c5aa/core/sql/bin/SqlciErrors.txt
----------------------------------------------------------------------
diff --cc core/sql/bin/SqlciErrors.txt
index 6c8933d,77e2041..6635d00
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@@ -1529,9 -1531,9 +1531,9 @@@ $1~String1 ----------------------------
8410 22025 99999 BEGINNER MINOR LOGONLY An escape character in a LIKE pattern must be followed by another escape character, an underscore, or a percent character.
8411 22003 99999 BEGINNER MINOR LOGONLY A numeric overflow occurred during an arithmetic computation or data conversion.$0~string0
8412 22024 99999 BEGINNER MINOR LOGONLY An input character host variable is missing its null terminator.
-8413 22007 99999 BEGINNER MINOR LOGONLY The string argument contains characters that cannot be converted.
+8413 22007 99999 BEGINNER MINOR LOGONLY The string argument contains characters that cannot be converted. Source data $0~string0
- 8414 0A000 99999 BEGINNER MINOR LOGONLY The attempted conversion is not supported on this platform.
+ 8414 0A000 99999 BEGINNER MINOR LOGONLY The attempted conversion is not supported on this platform.$0~string0
-8415 22007 99999 BEGINNER MINOR LOGONLY The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted.
+8415 22007 99999 BEGINNER MINOR LOGONLY The provided DATE, TIME, or TIMESTAMP is not valid and cannot be converted. Source data $0~string0
8416 22008 99999 BEGINNER MINOR LOGONLY A datetime expression evaluated to an invalid datetime value.
8417 ZZZZZ 99999 BEGINNER MAJOR DBADMIN An error occurred during the evaluation of USER function. The provided userid $0~string0 is invalid, incorrect, obsolete or inexistent and could not be converted to username.
8418 0A000 99999 BEGINNER MINOR LOGONLY The USER function is not supported on this platform.
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bb50c5aa/core/sql/exp/exp_conv.cpp
----------------------------------------------------------------------
diff --cc core/sql/exp/exp_conv.cpp
index 5e1e870,df24fcf..c10643d
--- a/core/sql/exp/exp_conv.cpp
+++ b/core/sql/exp/exp_conv.cpp
@@@ -1924,15 -1949,8 +1933,10 @@@ ex_expr::exp_return_type convAsciiToUIn
// 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[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;
- }
- SignFound = TRUE;
- negative = (source[currPos] == '-');
}
else if (source[currPos] == '.')
{ // process decimal point
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bb50c5aa/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bb50c5aa/core/sql/regress/executor/EXPECTED022.SB
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/bb50c5aa/core/sql/regress/hive/EXPECTED005
----------------------------------------------------------------------