Re: MDB2 and ampersand in prepared stmnt

From: Date: Thu, 31 Aug 2006 22:18:13 +0000
Subject: Re: MDB2 and ampersand in prepared stmnt
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-25034@lists.php.net to get a copy of this message
On 8/31/06, brian <brian@zijn-digital.com> wrote:
MDB2 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). -- Justin Patrin

« previous php.pear.general (#25034) next »