PRB: *StringLengthPtr Returns Incorrect Value When SQLGETInfo Called with Insufficient Buffer Size (294189)
The information in this article applies to:
- Microsoft Data Access Components 2.1
- Microsoft Data Access Components 2.5
- Microsoft Data Access Components 2.6
This article was previously published under Q294189 SYMPTOMS
When you call SQLGetInfo with a buffer size that is smaller than required, the string data is right-truncated as expected. According to the ODBC specification, in this situation, *StringLengthPtr should return the length of the requested information in bytes. The string passed back to the client is a regular char string (in other words, not Unicode), but when the string truncation occurs, the Driver Manager may return the length of the string in its Unicode form.
Here is an excerpt from the ODBC specification from Microsoft Developer Network (MSDN):
"The buffer *InfoValuePtr was not large enough to return all of the requested information, so the information was truncated. The length of the requested information in its untruncated form is returned in *StringLengthPtr. (Function returns SQL_SUCCESS_WITH_INFO.)"
CAUSE
The driver's SQLGetInfo function is always Unicode-based. The problem occurs in the Driver Manager. When the truncation occurs, the Driver Manager converts the Unicode string it receives from the driver to ANSI. However, it does not adjust the string length value accordingly, because it is allowing for a scenario where the data is entirely composed of double-byte character set (DBCS) data.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 11/17/2003 |
---|
Keywords: | kbprb KB294189 |
---|
|