in reply to Fill in SQL from Bind Values

This is what I came up with... as elegant as I could think but still feels hackery. But shouldn't there be a way to just get the straight SQL without the bind and placeholder values?
my @sql_char_list = map { my $char = $_; my $wanted = $char eq '?' ? shift @bind : $char; $wanted; } split '', $stmt; $stmt = join "", @sql_char_list; die Dumper $stmt;

Replies are listed 'Best First'.
Re^2: Fill in SQL from Bind Values
by hdb (Monsignor) on Oct 29, 2013 at 09:00 UTC

    Not sure you should be doing it this way, but you can distill your code into:

    $stmt =~ s/\?/shift @bind/ge;

    or with quotes

    $stmt =~ s/\?/"'".(shift @bind)."'"/ge;