Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Fix #44643: PDO-ODBC: bound parameters ignore explicit type definitions #620

Closed
wants to merge 2 commits into
from

Conversation

Projects
None yet
3 participants

This bug is also referenced in
#44643
pdo_odbc has had well-documented issues with parameterised queries accessing SQL Server for a long time. The issue is that when SQLDescribeParam does not return information about an input query parameter, pdo_odbc treats the parameter as a LONGVARCHAR or LONGVARBINARY. This patch modifies pdo_odbc to treat input parameters of less than 4000 characters in length as VARCHAR when the server does not return useful parameter information in response to the SQLDescribeParam call. This fixes behavior on SQL server, and shouldn't adversely affect behavior on other DBMS's, because the others for the most part return valid parameter info.

Bill Schaller added some commits Mar 10, 2014

Bill Schaller Fix #44643: PDO-ODBC: bound parameters ignore explicit type definitions
This bug is also referenced in
[#44643](https://bugs.php.net/bug.php?id=44643)
pdo_odbc has had well-documented issues with parameterised queries accessing SQL Server for a long time. The issue is that when SQLDescribeParam does not return information about an input query parameter, pdo_odbc treats the parameter as a LONGVARCHAR or LONGVARBINARY. This patch modifies pdo_odbc to treat input parameters of less than 4000 characters in length as VARCHAR when the server does not return useful parameter information in response to the SQLDescribeParam call. This fixes behavior on SQL server, and shouldn't adversely affect behavior on other DBMS's, because the others for the most part return valid parameter info.
6472f62
Bill Schaller Fix #44643: PDO-ODBC: bound parameters ignore explicit type definitions
Corrected issue with string lengths in fixed prepared statement code.
1c35578

Travic-CI fail is unrelated.

Contributor

smalyshev commented Apr 20, 2014

@zeroedin-bill could you add a test for this problem too?

@smalyshev @remus32 I'm not entirely sure how to go about adding an effective test for this. I'm not using this patch in production anywhere, and didn't go at testing it very extensively other than to verify some previously broken statements work with SQL Server 20XX.

I'm not sure how many people are using this extension, or how this change would affect usage on other platforms where SQLDescribeParam doesn't behave nicely. Many older versions of DBMSs (Teradata, DB/2, PostgreSQL, MSSQL, others) and some current versions of DBMSs such as SQL Server.

I think the changes provided here are a step towards the right solution, but it would take a programmer more experienced with the ODBC API than I to validate and craft tests for it.

Owner

krakjoe commented Jan 4, 2017

The reason nobody has moved on this is because it doesn't have any tests, or consensus that this is a good solution.

What I suggest is that you start a discussion on internals, this should draw out commentators and help to build a consensus.

Alternatively, if you consider this work abandoned, please close this PR.

@krakjoe - happy to close it. There is a SQL server driver for Linux coming out soon so the issue is moot anyway. And I don't even have to use SQL server anymore, anyway (thank goodness).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment