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

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.

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

Support for real prepared statements would be great, but is not part of this bug.