in reply to Re: Stringified hash
in thread Stringified hash
my @clauses; my @params; while (my ($k, $v) = each %hash) { push @clauses, "$k = ?"; push @params, $v; } my $query = "SELECT row_id FROM Table WHERE " . join(" AND ", @clauses +);
Then, when you execute that query using DBI, you pass @params to the execute() call. This will close a few security holes you currently have, as well as a few potential bugs. And, it's easier to read. :-)
------
We are the carpenters and bricklayers of the Information Age.
Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Stringified hash
by Anonymous Monk on Apr 12, 2004 at 16:53 UTC | |
by dragonchild (Archbishop) on Apr 12, 2004 at 16:56 UTC | |
|
Re: Re: Re: Stringified hash
by fizbin (Chaplain) on Apr 12, 2004 at 15:24 UTC |