trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ry...@apache.org
Subject [2/3] incubator-trafodion git commit: [TRAFODION-1262]ODBC:Varchar col operation fails use macro instead of 0x7fff and fix trancation of charset conv in unixodbc
Date Mon, 19 Dec 2016 01:52:59 GMT
[TRAFODION-1262]ODBC:Varchar col operation fails
use macro instead of 0x7fff and fix trancation of charset conv in unixodbc


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

Branch: refs/heads/master
Commit: e0cf313fe755538860d2cad4a204e1f182654014
Parents: c4a39d4
Author: rwbzx <xiang.zhang@esgyn.cn>
Authored: Fri Dec 2 18:18:03 2016 +0800
Committer: rwbzx <xiang.zhang@esgyn.cn>
Committed: Fri Dec 2 18:18:03 2016 +0800

----------------------------------------------------------------------
 core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdesc.cpp  |  4 ++--
 .../unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp  |  4 ++--
 .../unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp   | 10 +++++-----
 win-odbc64/odbcclient/drvr35/cdesc.cpp                    |  4 ++--
 win-odbc64/odbcclient/drvr35/ctosqlconv.cpp               | 10 +++++-----
 win-odbc64/odbcclient/drvr35/sqltocconv.cpp               |  3 +++
 6 files changed, 19 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e0cf313f/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdesc.cpp
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdesc.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdesc.cpp
index b844519..96ad330 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdesc.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdesc.cpp
@@ -598,14 +598,14 @@ unsigned long CDescRec::setDescRec(short DescMode, SQLItemDesc_def *SQLItemDesc)
 	case SQLTYPECODE_VARCHAR_WITH_LENGTH:
 		if (m_SQLCharset == SQLCHARSETCODE_UCS2)
 		{
-			if(SQLItemDesc->maxLen > 0x7fff)
+			if(SQLItemDesc->maxLen > SHRT_MAX)
 				m_SQLOctetLength = SQLItemDesc->maxLen+6;
 			else
 				m_SQLOctetLength = SQLItemDesc->maxLen+4;
 		}
 		else
 		{
-			if(SQLItemDesc->maxLen > 0x7fff)
+			if(SQLItemDesc->maxLen > SHRT_MAX)
 				m_SQLOctetLength = SQLItemDesc->maxLen+5;
 			else
 				m_SQLOctetLength = SQLItemDesc->maxLen+3;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e0cf313f/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp
index 05a7a37..2f96082 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/charsetconv.cpp
@@ -1029,7 +1029,7 @@ SQLRETURN ICUConverter::WCharToUTF8(UChar* wst, int wstlen, char *st,
int stlen,
 
 SQLRETURN  ICUConverter::UTF8ToWChar(char *st, int stlen, UChar *wst, int wstlen, int *translen,
char *error, DWORD dwFlags, int* reqLen)
 {
-	short len;
+	int len;
 	SQLRETURN rc = SQL_SUCCESS;
 	DWORD lastError;
 	error[0] ='\0';
@@ -1158,7 +1158,7 @@ SQLRETURN ICUConverter::WCharToISO88591(UChar* wst, int wstlen, char
*st, int st
 
 SQLRETURN  ICUConverter::ISO88591ToWChar(char *st, int stlen, UChar *wst, int wstlen, int
*translen, char *error, DWORD dwFlags, int* reqLen)
 {
-	short len;
+	int len;
 	SQLRETURN rc = SQL_SUCCESS;
 	DWORD lastError;
 	error[0] ='\0';

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e0cf313f/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
index 5663f09..cd1ddef 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
@@ -362,7 +362,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 	case SQL_LONGVARCHAR:
 	case SQL_WVARCHAR:
 		{
-			if(targetPrecision > 0x7fff)
+			if(targetPrecision > SHRT_MAX)
 			{
 				Offset = sizeof(UINT);
 			}
@@ -655,7 +655,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 		if (Offset != 0)
 		{
 //#ifndef MXSUN
-			if(targetPrecision > 0x7fff){
+			if(targetPrecision > SHRT_MAX){
 				outDataPtr = (unsigned char *)targetDataPtr + sizeof(int);
 			}
 			else{
@@ -3218,7 +3218,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 				}
 				if (Offset != 0)
 				{
-					if(targetPrecision > 0x7fff)
+					if(targetPrecision > SHRT_MAX)
 						*(unsigned int *)targetDataPtr = DataLen;
 					else
 						*(unsigned short *)targetDataPtr = DataLen;
@@ -3269,7 +3269,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 				}
 				if (Offset != 0)
 				{
-					if(targetPrecision > 0x7fff)
+					if(targetPrecision > SHRT_MAX)
 					{
 						if(iconv->getUCS2Translation())
 							*(unsigned int *)targetDataPtr = DataLen*2;
@@ -3330,7 +3330,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 				}
 				if (Offset != 0)
 				{
-					if(targetPrecision > 0x7fff)
+					if(targetPrecision > SHRT_MAX)
 						*(unsigned int *)targetDataPtr = DataLen;
 					else
 						*(unsigned short *)targetDataPtr = DataLen;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e0cf313f/win-odbc64/odbcclient/drvr35/cdesc.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/cdesc.cpp b/win-odbc64/odbcclient/drvr35/cdesc.cpp
index 461c13c..f1e01ea 100644
--- a/win-odbc64/odbcclient/drvr35/cdesc.cpp
+++ b/win-odbc64/odbcclient/drvr35/cdesc.cpp
@@ -559,7 +559,7 @@ unsigned long CDescRec::setDescRec(short DescMode, SQLItemDesc_def *SQLItemDesc)
 	case SQLTYPECODE_VARCHAR_WITH_LENGTH:
 		if (m_SQLCharset == SQLCHARSETCODE_UCS2)
 		{
-			if (SQLItemDesc->maxLen > 0x7fff)
+			if (SQLItemDesc->maxLen > SHRT_MAX)
 			{
 				m_SQLOctetLength = SQLItemDesc->maxLen + 6;  //4 bytes for len and 2 bytes of null
 			}
@@ -570,7 +570,7 @@ unsigned long CDescRec::setDescRec(short DescMode, SQLItemDesc_def *SQLItemDesc)
 		}
 		else
 		{ 
-			if (SQLItemDesc->maxLen > 0x7fff)
+			if (SQLItemDesc->maxLen > SHRT_MAX)
 			{
 				m_SQLOctetLength = SQLItemDesc->maxLen + 5;  //4 bytes for len and 1 byte of null
 			}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e0cf313f/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp b/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
index f9be84c..fb2a312 100644
--- a/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
+++ b/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
@@ -284,7 +284,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 	case SQL_VARCHAR:
 	case SQL_LONGVARCHAR:
 	case SQL_WVARCHAR:
-		if (targetPrecision > 0x7fff){
+		if (targetPrecision > SHRT_MAX){
 			Offset = sizeof(UINT);
 		}
 		else{
@@ -566,7 +566,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 		}
 		if (Offset != 0)
 		{
-			if (targetPrecision > 0x7fff)
+			if (targetPrecision > SHRT_MAX)
 				outDataPtr = (unsigned char *)targetDataPtr + sizeof(UINT);
 			else
 				outDataPtr = (unsigned char *)targetDataPtr + sizeof(USHORT);
@@ -3026,7 +3026,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 				}
 				if (Offset != 0)
 				{
-					if (targetPrecision > 0x7fff)
+					if (targetPrecision > SHRT_MAX)
 						*(unsigned int *)targetDataPtr = DataLen * 2;
 					else
 						*(unsigned short *)targetDataPtr = DataLen * 2;
@@ -3043,7 +3043,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 				memcpy(outDataPtr, DataPtr, DataLen);
 				if (Offset != 0)
 				{
-					if (targetPrecision > 0x7fff)
+					if (targetPrecision > SHRT_MAX)
 						*(unsigned int *)targetDataPtr = DataLen;
 					else
 						*(unsigned short *)targetDataPtr = DataLen;
@@ -3076,7 +3076,7 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 				DataLen = translateLength;
 				if (Offset != 0)
 				{
-					if (targetPrecision > 0x7fff)
+					if (targetPrecision > SHRT_MAX)
 						*(unsigned int *)targetDataPtr = DataLen;
 					else
 						*(unsigned short *)targetDataPtr = DataLen;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e0cf313f/win-odbc64/odbcclient/drvr35/sqltocconv.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/sqltocconv.cpp b/win-odbc64/odbcclient/drvr35/sqltocconv.cpp
index 69c8363..ab56ccf 100644
--- a/win-odbc64/odbcclient/drvr35/sqltocconv.cpp
+++ b/win-odbc64/odbcclient/drvr35/sqltocconv.cpp
@@ -1411,6 +1411,7 @@ unsigned long ODBC::ConvertSQLToC(SQLINTEGER	ODBCAppVersion,
 	case SQL_C_DATE:
 	case SQL_C_TYPE_DATE:
 		DataPtr = &dateTmp;
+		DataLen = sizeof(DATE_STRUCT);
 		switch (ODBCDataType)
 		{
 		case SQL_CHAR:
@@ -1656,6 +1657,7 @@ unsigned long ODBC::ConvertSQLToC(SQLINTEGER	ODBCAppVersion,
 	case SQL_C_TIME:
 	case SQL_C_TYPE_TIME:
 		DataPtr = &timeTmp;
+		DataLen = sizeof(TIME_STRUCT);
 		switch (ODBCDataType)
 		{
 		case SQL_CHAR:
@@ -1880,6 +1882,7 @@ unsigned long ODBC::ConvertSQLToC(SQLINTEGER	ODBCAppVersion,
 	case SQL_C_TIMESTAMP:
 	case SQL_C_TYPE_TIMESTAMP:
 		DataPtr = &timestampTmp;
+		DataLen = sizeof(TIMESTAMP_STRUCT);
 		switch (ODBCDataType)
 		{
 		case SQL_CHAR:


Mime
View raw message