in reply to Re: SQL LIKE and Binding Variables
in thread SQL LIKE and Binding Variables
Ok, thanks.
If I combine the suggestions from Jenda and erix it seems to work pretty well.
my @vals =("artist1", "artist2"); my $sth = $db->prepare(q{SELECT * FROM Songs WHERE Songs.Artist LIKE ' +%'||?||'%' OR Songs.Artist LIKE '%'||?||'%'});# suggestion from Jenda my $results = $sth->execute( @vals ) or die("Failed to Execute SQL");
I'm now struggling to work out the syntax to combine the placeholder '%'||?\\'?' with a join and map statement that I can pass a an array of values.
Does anyone know the trick to get this syntax right?
If it matters - I am running ActivePerl on Vista X64 and using SQLite for my DB back end.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: SQL LIKE and Binding Variables
by Jenda (Abbot) on Nov 06, 2009 at 17:42 UTC | |
by Mad_Mac (Beadle) on Nov 06, 2009 at 22:40 UTC | |
by Mad_Mac (Beadle) on Nov 06, 2009 at 22:23 UTC |