Re: Passing arrays of strings with backslashes as parameters
Tim Landscheidt <[email protected]> Sat, 12 Feb 2011 00:54:07 +0000
| Newsgroups | gmane.comp.db.postgresql.dbdpg |
|---|---|
| Organization | <URI:http://www.tim-landscheidt.de/> |
| Message-ID | <[email protected]> |
[email protected] (Rudy Lippan) wrote: >>> an implementation problem in DBD::Pg, but I am not convinced. What does >>> a DBI->trace(9) show? >>> [...] >> | DBI->trace (9); >> | my $DB = DBI->connect ('dbi:Pg:dbname=tim', undef, undef, { pg_enable_utf8 => 1, PrintError => 0 }) or die (DBI->errstr ()); >> | my $TestOutput = $DB->selectcol_arrayref ('SELECT LENGTH(unnest(?::TEXT[]));', {}, ['abc', 'def', 'g\hi']) or die ($DB->errstr ()); >> | $DB->disconnect () or die ($DB->errstr ()); >> | print Dumper $TestOutput; >> gives about 300 lines of output: > [...] >> | Begin dbd_bind_ph (ph_name: 1) >> | Begin pg_stringify_array >> | End pg_stringify_array (string: '{"abc","def","g\\\\hi"}') > My first impresison is that pg_stringify_array is giving you your extra > backslash. I don't have time to dig much into it right now. Maybe > someone who knows that bit of code could tell you what the problem is.... >> | Bind (1) (type=0) >> | End dbd_bind_ph (special) >> | Begin dbd_st_execute >> | PQexecPrepared item #0 >> | -> Value: ({"abc","def","g\\\\hi"}) I think Noah's patch (cf. <URI:http://rt.cpan.org/Public/Bug/Display.html?id=58552>) addresses the problem, but I haven't tested it yet. Maybe some developer could take a deeper look into it? Tim