-
Notifications
You must be signed in to change notification settings - Fork 7.8k
ODBC HY010 when binding parameter that is larger than the column definition #9372
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
Comments
Yeah, that is a known issue. We definitely need to fix the error handling. I'm not sure about actually trying to fix this issue, especially since apparently only some drivers have an issue with binding such overlong values. |
If `SQLPutData()` *fails*, we should not call `SQLParamData()` again, because that yields the confusing `HY010` (Function sequence error). Instead we properly handle `SQLPutData()` errors. For the given case (paramter length > column length), some drivers let `SQLPutData()` fail, while others do not. Either behavior seems to conform to the ODBC specification. Anyhow, we do not want to silently truncate the given parameter, since that would break the behavior for drivers which do not fail, but still don't simply truncate the given parameter. So it is finally up to userland to avoid passing overlong parameters – with this patch they at least get useful information about the actual issue.
After some further investigation, I don't think that we can silently truncate overlong parameters, since this would break the behavior for drivers not reporting failure on |
If `SQLPutData()` *fails*, we should not call `SQLParamData()` again, because that yields the confusing `HY010` (Function sequence error). Instead we properly handle `SQLPutData()` errors. For the given case (paramter length > column length), some drivers let `SQLPutData()` fail, while others do not. Either behavior seems to conform to the ODBC specification. Anyhow, we do not want to silently truncate the given parameter, since that would break the behavior for drivers which do not fail, but still don't simply truncate the given parameter. So it is finally up to userland to avoid passing overlong parameters – with this patch they at least get useful information about the actual issue.
* PHP-8.2: Fix GH-9372: HY010 when binding overlong parameter
Description
The following code:
Resulted in this output:
The error only happens when the bound parameter is larger than the column as defined. Does not happen when using literals within the query string. I would expect to just receive 0 results not an error.
PHP Version
PHP 8.1.9
Operating System
Debain 10.11
The text was updated successfully, but these errors were encountered: