David Manura wrote:
SQL-Interpolate 0.31 is now available on CPAN: http://search.cpan.org/dist/SQL-Interpolate/ . This includes a new ("WHERE", {x => [EMAIL PROTECTED], ...}) syntax, bug fixes, and clarified documentation. Discussions on the module will now take place on the CPAN::Forum (http://www.cpanforum.com/dist/SQL-Interpolate).


Have you considered just embedding the variable references
in the SQL string (ala SQL::Preproc
http://search.cpan.org/~darnold/SQL-Preproc-0.10/Preproc.pod) ?
E.g.,

my ($col1, $col2, $col3, $param1, $param2);
#...set values...
my $sth = $dbh->prepare(
'select * into :$col1, :$col2, :$col3
from mytable
where somecolumn = :$param1 or othercolumn < :$param2');

While double quoted SQL strings are problematic, single quoted
SQL and heredocs should be OK, (and, of course, escaping
the perl variable in double quoted strings works too).

You should be able to collect/translate the placeholders
at runtime, and use eval {} to apply them to the
translated statement. (which is different than SQL::Prepoc,
which uses a source filter to collect/translate).

Dean Arnold
Presicient Corp.

Reply via email to