Bug->Req #60818 [Opn]: PDO_DBLIB: cannot quote strings as NVARCHAR

From: Date: Mon, 12 Sep 2016 21:19:26 +0000
Subject: Bug->Req #60818 [Opn]: PDO_DBLIB: cannot quote strings as NVARCHAR
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203978@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60818&edit=1 ID: 60818 Updated by: adambaratz@php.net Reported by: wrobel at wsb-nlu dot edu dot pl -Summary: PDO_DBLIB: Problem storing UTF data +Summary: PDO_DBLIB: cannot quote strings as NVARCHAR Status: Open -Type: Bug +Type: Feature/Change Request Package: PDO DBlib PHP Version: Irrelevant Block user comment: N Private report: N New Comment: This is a limitation of how PDO handles types. I implemented a hackish solution here: https://github.com/wayfair/php-src/commit/0190df6da7a4c39b235a75161fdc880acde5c28f It's not clean enough for general use, but could work in a pinch if you're willing to do a custom build. I sketched out a better solution here: https://github.com/php/php-src/pull/2017#discussion_r72349801 Previous Comments: ------------------------------------------------------------------------ [2012-04-02 03:28:56] ssufficool@php.net This will require a re-write of the PDO_DBLIB to allow the use of the "encoding" option. After that, all queries and parameter will require you to encode them before binding with utf8_encode(). You will also have to decode them using utf8_decode() when returned from the server. I was working to bring full Unicode support to the driver, but it would have broken so much code I had to rethink the strategy. ------------------------------------------------------------------------ [2012-01-24 11:32:39] redman dot naw at gmail dot com Hi, -you should use utf8_decode to convert UTF8 character to ISO-8859-1(latin-1) character - i use this function with MySQL, that's work :D ------------------------------------------------------------------------ [2012-01-20 12:04:20] wrobel at wsb-nlu dot edu dot pl Description: ------------ I have a problem storing UTF data on MSSQL using pdo_dblib. In the following query: EXECUTE p_proc id = :id, @name = :name I cannot bind the ":name" param using the N'string' notation required by SQL Server (see http://support.microsoft.com/kb/239530) You cannot get around this by typing: EXECUTE p_proc id = :id, @name = N:name because binding fails on N:name The same problem happens with qoute function - it allways quotes with '' a never with N'' - perhaps there should be a new param like PDO::PARAM_STR to tell that with deal with a Unicode value? ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60818&edit=1

« previous php.bugs (#203978) next »