in reply to Re: Simple DBI question, select rows based on an array
in thread Simple DBI question, select rows based on an array
That could get you into trouble with quote problems in @array values or worse sql-injection. At the very least you should use the DBI quote method:
my $sql = 'SELECT * FROM table WHERE column IN (' . ( join ',', map { $dbi->quote($_) } @array ) . ')';
Or better, use placeholders
my $sql = 'SELECT * FROM table WHERE column IN (' . '?' . (',?' x $#array) . ')';
|
|---|