As a rule of thumb, you can only use SQL placeholders when the database can still come up with a query plan. Using a different table prevenets your database from coming up with a sensible query plan.
A more concise way to say this is that the placeholders can only stand in place for values, not for arbitrary syntax constructs.
You will have to construct the SQL by creating a string and replacing the variable parts in the string yourself.
There are some query builders, like SQL::Abstract, or DBIx::PreQL. In my experience, I found query builders to be too tedious, as I usually have to fight them too hard to get the SQL I want them to generate. I haven't used DBIx::PreQL, but it should allow you a more parametrized approach.
In reply to Re: Perl DBI '?' substitution with prepare/execute
by Corion
in thread Perl DBI '?' substitution with prepare/execute
by nikmit
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |