-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
3.52.15 DM truncating SQL_C_WCHAR parameter value when bound w/ BufferLength=0 & length indicator of SQL_NTS #68
Comments
The same thing happens if BufferLength is set exactly to the length of the string in bytes (not including the null terminator). In this case, we're setting the length indicator to SQL_NTS, and the buffer actually contains a length indicator, but I'm not sure if this is 'correct' (since technically the null terminator is outside of the buffer as described to the DM/Driver), but again, it used to work. |
As indicated by @pkleef this issue has been assigned for fixing. Thus, expect a fix later today or tomorrow. |
It is unclear, why BufferLength isn't include null terminator => https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/sqlbindparameter-function?view=sql-server-ver15#bufferlength-argument
|
that passage is about output parameters:
|
@matthew-wozniczka |
In this case I'm not using parameter arrays (having a bufferlength of 0 definitely would not work there) |
@matthew-wozniczka
What kind of value did you use for |
What kind of ODBC driver did you use Unicode or ANSI ? |
Fixed. The issue, when
About:
It will work ONLY, if Unicode conversion isn't used(Unicode->Ansi or UCS4->UCS2 and etc), |
Fixed by: 0b90ca1 |
I'm not sure if passing a bufferlength of 0 to SQLBindParameter for a string parameter while using a length indicator of SQL_NTS is completely kosher, but it used to work (circa 3.52.8, and in other DMs).
I find that the DM seems to try to support it, in
_SQLExecute_ConvParams
it computeselementSize
to be the size in bytes, without the null terminator, and then in_ConvParam
->_ExecConv_W2W
it copies the entire value back to the buffer, but then overwrites the last character with a null terminator.The text was updated successfully, but these errors were encountered: