On Mon Mar 10, 2008 at 11:09:55AM -0400, John Goulah wrote:
>
> We have some code for this written by Jeff Lanza, I'm not sure its flawless
> but its a start :)
Here is an alternative implementation which I use in my code (is
actually an object method assuming a live DBI dbh in $self->dbh):
sub query_as_string {
my $self = shift;
my $sql = shift || croak 'query_as_string($sql, @bind_params)';
foreach (@_) {
if (defined($_) and $_ !~ /^[[:print:]]+$/) {
$sql =~ s/\?/*BINARY DATA*/;
}
else {
my $quote = $self->dbh->quote($_);
$sql =~ s/\?/$quote/;
}
}
return $sql;
}
Feel free to use as you like.
Mark.
--
Mark Lawrence
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/[EMAIL PROTECTED]