Microsoft KB Archive/202852

= FIX: SQLGetData Returns Extra Character For StrLen_or_IndPtr =

Article ID: 202852

Article Last Modified on 9/30/2003

-

APPLIES TO


 * Microsoft Open Database Connectivity 2.0
 * Microsoft Open Database Connectivity 2.0
 * Microsoft Open Database Connectivity 2.0
 * Microsoft Open Database Connectivity 2.0

-



This article was previously published under Q202852



SYMPTOMS
Using SQLGetData, the StrLen_or_IndPtr is the length of TargetValuePtr + 1. The length is including the NULL terminator for the string.



RESOLUTION


STATUS
Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. This bug has been corrected in Microsoft's Oracle ODBC Driver 2.573.2927 and higher. This driver is available in MDAC 2.0, part Visual Studio 6.0, and the latest MDAC version can be downloaded from the following Web site:

http://msdn.microsoft.com/dataaccess



Steps to Reproduce Behavior
Use ODBC Test to perform the following steps:

 Connect to a data source using the driver. Call SQLGetTypeInfo (to create a result set).  Call SQLExtendedFetch: In:StatementHandle = 0x00301250, FetchOrientation = SQL_FETCH_NEXT=1, FetchOffset = 1, RowCountPtr = 0x0014B348, RowStatusArray = 0x0014B378 Return:  SQL_SUCCESS=0 Out: *RowCountPtr = 1, *RowStatusArray = 0   Call SQLGetData: In: Statementhandle = 0x00301250, ColumnNumber = 1, TargetType = SQL_C_CHAR=1, TargetValuePtr = 0x0014BF10, BufferLength = 256, StrLen_or_IndPtr = 0x0014AD58 Return:  SQL_SUCCESS=0 Out: *TargetValuePtr = "LONG RAW", *StrLen_or_IndPtr = 9 

NOTE: StrLen_or_IndPtr equals nine, yet there are only eight characters in the TargetValuePtr.

Expected behavior: Out: *TargetValuePtr = "LONG RAW", *StrLen_or_IndPtr = 8

