My present understanding of placeholders is that they inform the database as to the form or pattern of subsequent queries, essentially providing structure to those queries which are yet to come.
I think perhaps I see where the misconception is here. What you are describing is query preparation and while that can be done for a single, isolated query it may not be necessary. However, placeholders are also used to safely interpolate data into the content of the current query. So you can use placeholders in a single query without performing explicit preparation. eg.
my $rows = $dbh->selectall_arrayref ('SELECT foo FROM bar WHERE quux = + ?', undef, $unsafe_input);
Always use placeholders. Always.
🦛
In reply to Re^7: Best practices for closing database connections?
by hippo
in thread Best practices for closing database connections?
by Polyglot
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |