Re: MDB2 and ampersand in prepared stmnt
| From: | brian | Date: | Thu, 31 Aug 2006 22:59:11 +0000 |
| Subject: | Re: MDB2 and ampersand in prepared stmnt | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25038@lists.php.net to get a copy of this message | ||
Justin Patrin wrote:
On 8/31/06, brian <brian@zijn-digital.com> wrote:Thanks, i'll give that a go. If anyone has any idea where in the source this may be happening, i'd be happy to look into it. I figured it was occuring in bindValue(). As it is, though, i'm pretty lost wading through this.. bMDB2 2.2.0 MDB2_Driver_pgsql 1.2.0 I'm seeing my text being decapitated after an ampersand using $mdb2->prepare(). I haven't seen this documented anywhere and google only shows me this 2-year-old bug that looks related: http://pear.php.net/bugs/bug.php?id=31&edit=2 There's a comment from the Lukas: "this looks like a more generic problem in how prepare is emulated in DB_Common. Generally the user should have to escape the prepare placeholders and prepare would have to check for the escape char." Can someone translate this? How do i escape the placeholder, and is this a suggestion to patch the source myself? I can do my own replace on ampersands (and then replace them back when i pull it from the db) but that seems like a pretty ugly hack. Any suggestions?Try replacing & with something like &'||' for now (this is post-quote, of course, and assuming that pgsql uses ' for quoting and || is valid for concatenation).