ZF-9255: Zend_Db_Adapter_Sqlsrv missing unicode support
Description
Current version of Zend_Db_Adapter_Sqlsrv doesn't support to query unicode characters (i.e Japanese) in the database without prepared statements. As upddate(), delete() and fetchAll() methods don't support "real" prepared statements (str_replaces are done in the methods) it's not possible to support unicode characters.
The problem lies in the _quote method of Zend_Db_Adapter_Sqlsrv, as it doesn't quote to a unicode string. Microsoft SQL Server requires an prepended N to recognize unicode strings. So a query with japanese characters has to look like this: SELECT * FROM myTable WHERE myColumn = N'[japanese characters]';
So _quote method should also prepend the N for unicode characters. For this also the Zend_Db_Statement _stripQuoted method has to be adjusted as this only works with a single quoting character, which also has to be the same at start and end.
Comments
Posted by Tobias Zander (t.zander) on 2010-02-24T09:01:42.000+0000
We created this patch to fix this problem. It prepends the required N and extends _stripQuoted to also handle this kind of quoting.
We hope this helps to fix that bug in one of the next releases.
Posted by Justinas L. (medutis) on 2010-03-25T02:47:02.000+0000
This patch could be OK, but what about prepared statements? I still can't get my unicode strings with db->update or db->insert methods
Posted by Tobias Zander (t.zander) on 2010-08-03T06:24:56.000+0000
Support for real prepared statements would be great, but is not part of this bug.