Sometimes I keep the placeholders in an array to mention them...
I haven't yet found a coding style for placeholders with which I'm completely happy.
For a simple query I just keep them inline:
But for more placeholders I've tried this:my $row = $dbh->selectrow_hashref("SELECT * FROM table WHERE idTable = + ?", under, $id);
IMHO that is too spread out. So instead I generally adopt this way if I have lots of placeholders.my $row = $dbh->selectrow_array("SELECT * FROM table WHERE idTable = ? + AND some_column = ? AND another_column = ? AND name = ?", under, $table_id, $column_data, $column_info, $name);
Or, if there are silly numbers of placeholders, I will preload them into an array and just pass that to the DBI method.my $row = $dbh->selectrow_array("SELECT * FROM table WHERE idTable = ? + AND some_column = ? AND another_column = ? AND name = ?", under, $table_id, $column_data, $column_info, $name);
In reply to Re^4: DBI and JSON fields
by Bod
in thread DBI and JSON fields
by Bod
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |