I'm trying to use Perl Dancer quick_select
to quickly fetch rows from the database. I'm using a list of items from the user that I got like this: my @arr=split(/,/, $inline);
I keep getting this error when using the items from the user:
DBD::mysql::db selectall_arrayref failed: Unknown column 'val2' in 'where clause'
This does not work:
my @rows = $connect->quick_select('table', { column => @arr});
But this does work:
my @rows = $connect->quick_select('table', { column => ['val1', 'val2']});`
Apparently []
denotes a list but @arr
is an array in Perl? So I've tried converting it to a list but this also does not work:
my @rows = $connect->quick_select('table', { column => @arr[0..$#arr]});
The table and column names have been changed to protect the data. How can I fix this so quick_select
will work with dynamic data from the user?