On 05/13/2017 09:08 PM, lee wrote:
Hi,
would you say this acceptable or something that should be forbidden?
my $sth_cmds = $dbh->prepare_cached($sql);
my @params;
push(@params, undef) foreach(0..12);
$sth_cmds->execute();
$sth_cmds->bind_columns(eval join(', ', map('\$params[' . $_ . ']',
0..$#params)));
I haven't used 'eval' before, and this seems inherently dangerous.
you are correct in that string eval is very dangerous. my rule is you
never use it until you learn when not to use it! :)
you likely want to use the dbi calls that return a hash for each row you
select. i always forget the name but it is something like
fetchall_hashrows. you can look it up easily. it is generally the nicest
way to get rows from dbi IMO.
uri
--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/