trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [1/2] incubator-trafodion git commit: [TRAFODION-2811] When convert NULL to SQL_VARCHAR, the length was not be sent
Date Tue, 21 Nov 2017 21:48:24 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 19c75441b -> 156829272


[TRAFODION-2811] When convert NULL to SQL_VARCHAR, the length was not be sent


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

Branch: refs/heads/master
Commit: d93d17e70ff517d94cde5fee62001948fe209589
Parents: 89433fb
Author: Weixin-Xu <xwx@weixin-1.novalocal>
Authored: Mon Nov 20 09:56:58 2017 +0800
Committer: Weixin-Xu <weixin.xu@esgyn.cn>
Committed: Mon Nov 20 10:26:44 2017 +0800

----------------------------------------------------------------------
 core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp | 7 +++++++
 win-odbc64/odbcclient/drvr35/ctosqlconv.cpp                   | 7 +++++++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d93d17e7/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 6d8f11b..bab28c5 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/ctosqlconv.cpp
@@ -3510,6 +3510,13 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 			if (OutLen < DataLen)
 				return IDS_22_001;
 			memcpy(outDataPtr, DataPtr, DataLen);
+            if (Offset != 0)    //When Datalen = 0, length was not stored in buffer
+            {
+                if(targetPrecision > SHRT_MAX)
+                    *(unsigned int *)targetDataPtr = DataLen;
+                else
+                    *(unsigned short *)targetDataPtr = DataLen;
+            }
 		}
 		if (byteSwap)
 		{

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/d93d17e7/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp b/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
index fe1c58e..2b1a39f 100644
--- a/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
+++ b/win-odbc64/odbcclient/drvr35/ctosqlconv.cpp
@@ -3253,6 +3253,13 @@ unsigned long ODBC::ConvertCToSQL(SQLINTEGER	ODBCAppVersion,
 			if (OutLen < DataLen)
 				return IDS_22_001;
 			memcpy(outDataPtr, DataPtr, DataLen);
+			if (Offset != 0)	//When Datalen = 0, length was not stored in buffer
+			{
+				if (targetPrecision > SHRT_MAX)
+					*(unsigned int *)targetDataPtr = DataLen;
+				else
+					*(unsigned short *)targetDataPtr = DataLen;
+			}
 		}
 		if (byteSwap) 
 		{


Mime
View raw message