You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2017/11/21 21:48:24 UTC

[1/2] incubator-trafodion git commit: [TRAFODION-2811] When convert NULL to SQL_VARCHAR, the length was not be sent

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 <xw...@weixin-1.novalocal>
Authored: Mon Nov 20 09:56:58 2017 +0800
Committer: Weixin-Xu <we...@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) 
 		{


[2/2] incubator-trafodion git commit: Merge [TRAFODION-2811] PR 1305 Fix issue with converting NULL to SQL_VARCHAR

Posted by db...@apache.org.
Merge [TRAFODION-2811] PR 1305 Fix issue with converting NULL to SQL_VARCHAR


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

Branch: refs/heads/master
Commit: 156829272313dfa314a43d050ca40d3d186f9b0c
Parents: 19c7544 d93d17e
Author: Dave Birdsall <db...@apache.org>
Authored: Tue Nov 21 21:46:36 2017 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Tue Nov 21 21:46:36 2017 +0000

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