in reply to Re: DBD::SQLite, how to pass array in query via placeholder?
in thread DBD::SQLite, how to pass array in query via placeholder?
Oops, I shoulda use single quotes for that SQL statement in Perl part, thanks for noticing. I'll correct the question.
Regarding placeholders, they do work i.e. in Postgres. This code is perfectly valid with DBD::Pg:
$sth = $dbh->prepare('SELECT * FROM foo WHERE foo = $1 AND bar = ANY ($2)'); $sth->execute(1, [1,2,3]);
In fact, I was porting this code from Pg to SQLite and stumbled on this discrepancy. I don't want to modify the query, it's passed on me (mine is a module) along with parameters from calling application. Kind of templating at work here. Parsing SQL select statements is not a trivial task, I don't want to reinvent the wheel (again).
Regards,
Alex.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: DBD::SQLite, how to pass array in query via placeholder?
by Corion (Patriarch) on Apr 09, 2011 at 19:20 UTC | |
by dwalin (Monk) on Apr 09, 2011 at 19:46 UTC | |
by Corion (Patriarch) on Apr 09, 2011 at 19:48 UTC |