Bug #67495 [Com]: pdo_dblib incorrectly escapes binary and unicode values
| From: | kraven at kraven dot org | Date: | Wed, 30 Jul 2014 12:25:08 +0000 |
| Subject: | Bug #67495 [Com]: pdo_dblib incorrectly escapes binary and unicode values | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-186882@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67495&edit=1
ID: 67495
Comment by: kraven at kraven dot org
Reported by: vytas dot LT at gmail dot com
Summary: pdo_dblib incorrectly escapes binary and unicode
values
Status: Open
Type: Bug
Package: PDO DBlib
PHP Version: 5.6Git-2014-06-22 (Git)
Block user comment: N
Private report: N
New Comment:
I can confirm this is an issue for a long time now. This fix will remove the need for the
workaround in Propel ORM 1.7.x runtime/lib/adapter/DBMSSQL.php cleanupSQL method.
Previous Comments:
------------------------------------------------------------------------
[2014-06-22 21:01:57] sdfghjk at fff dot lt
e ble
------------------------------------------------------------------------
[2014-06-22 20:49:08] vytas dot LT at gmail dot com
Description:
------------
For storing unicode text MSSQL has nchar and nvarchar column types
However, pdo_dblib extension does not correctly escapes unicode strings.
Those strings must be prefixed with N prefix - e.g.
INSERT INTO table(field) (N'unicode_value')
UPDATE table SET field = N'unicode_value' WHERE code = N'unicode_value'
Likewise binary, varbinary and blob should be escaped like unquoted hexadamical notation starting
with 0x - e. g.
INSERT INTO table(binfield) (0xAAFFCC)
UPDATE table SET binfield = 0xAAFFCC WHERE code = 0xCCAAFF
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67495&edit=1