in reply to Re^5: DBI parameterized database query with comma seperated list
in thread DBI parameterized database query with comma seperated list
Note I've pulled a whole list of arguments straight from the web, and passed them to the interface unscrubbed.my $db = DBI->connect(...); my @list = CGI->param('arguments'); my $sql = do { my @holders = ('?') x @list; local $" = ','; <<EOSQL; SELECT something FROM atable WHERE data IN (@holders) EOSQL }; my $query = $db->prepare($sql); $query->execute(@list);
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^7: DBI parameterized database query with comma seperated list
by Pope-O-Matik (Pilgrim) on Dec 22, 2015 at 04:44 UTC |