Re: Translate between DBI and SQL

2019-02-12 Thread David Nicol
Tie::Function can be used to bind $dbh->quote to a syntactical hash, so you can interpolate arbitrary strings easier. When I do that I name the hash %Q, and then it's safe to do things like $sql_text = "select id from mytable where foo=$Q{$foo}"; rather than counting placeholders. On Fri, Feb

Re: Translate between DBI and SQL

2019-02-12 Thread Peter Vanroose
Short answer, assuming you are including hard-coded SQL into a Perl script: Place the textual SQL, without any additional backslashes or extra quotes or whatsoever, within the following: my $sql_text = q( ); Unless you have a closing ")" without a preceding opening "(" in that SQL text (which w