Re: MDB2 and ampersand in prepared stmnt
| From: | brian | Date: | Fri, 01 Sep 2006 00:13:20 +0000 |
| Subject: | Re: MDB2 and ampersand in prepared stmnt | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-25039@lists.php.net to get a copy of this message | ||
brian wrote:
Justin Patrin wrote:Resolved. It wasn't MDB2 at all. When i'd tested, i'd dumped everything up until just before my class executed the statement and found that the text wasn't cut until it then. However, i'd completely missed the obvious. The app is an admin interface, with controls to both save some data plus see a preview. The latter works through javascript saving the data with HTTPRequest, then opening a new window and calling the preview script. Yep, that's right - i was using encodeURI instead of encodeURIComponent. So, when i previewed (as opposed to just saving), the text was being cut when it arrived from the HTTPRequest call. SORRY LUKAS - i'm an idiot! bOn 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).