appsfortableau / laravel-pdo-odbc

ODBC/Snowflake integration for Laravel Framework to easily create a ODBC connection via Laravel Eloquent.
27 stars 21 forks source link

Issue With Prepared Statements #36

Open aldobarr opened 2 months ago

aldobarr commented 2 months ago

I recently reported an issue with named parameter bindings to the snowflake pdo driver but after a bit more digging it looks like the issue might actually be with this package.

Please see this issue for full details: https://github.com/snowflakedb/pdo_snowflake/issues/396

But to summarize, it looks like named parameter binds are not working as they should be. Come to think of it the reason it most likely didn't break in our production is because our prod environment is not yet on 1.2.5. So potentially something about 1.2.5 broke it.

While debugging this and going through this package's code during execution, it looks like the package is trying to handle the parameters itself instead of passing them to the statement to let PDO handle it...? And only when positional params are used otherwise bindings are entirely ignored...? It seems very strange to me the way this package is implementing PDO.

yoramdelangen commented 2 months ago

Your correct. Please note in the past we only had a ODBC integration and not the PDO Snowflake. This does not work in the ODBC integration either so I think the PDO Snowflake package uses the ODBC connector internally. We didn't find a workaround yet for this problem, and avoid using named parameters. A workaround could be manipulation of the query string just as we are doing with the positional one, but more manual.