pdo-odbc doesn't work whit bind values, nvarchar and text are incompatible in the equal to operator

ぐ巨炮叔叔 提交于 2019-12-01 18:03:16

Having done a fair bit of research into this it seems pdo_odbc is buggy on 64-bit architectures: it's built with 32-bit SQLLEN and SQLULEN sizes. Microsoft's driver used to be built this way, which is probably why PHP followed suit. MS have since started to follow the ODBC spec properly, but apparently PHP hasn't.

The patch referenced in the question fixes one such problem in the PHP source, but seemingly not all such problems. Using the MS driver and a patched PHP I was still unable to run prepared statements.

I actually found the same problem when using Easysoft's driver, and talking through the issues with them discovered that pdo_odbc is the culprit. They were able to provide me with a 64-bit driver built using 32-bit sizes, and that works fine.

Until 64-bit PHP is patched to use 64-bit SQLLEN and SQLULEN sizes it looks like the best Free solution is to use 32-bit PHP and ODBC drivers.

same error here:

PDOStatement::execute(): SQLSTATE[22001]: String data, right truncated: 0 [Microsoft][SQL Server Native Client 11.0]Die Zeichenfolgedaten wurden rechts abgeschnitten (SQLExecute[0] at ext\pdo_odbc\odbc_stmt.c:254)

Win7 64bit, PHP 5.4.12, SQL Server Express 2012, ODBC 11 for SQL Server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!