From: Arthur Axel 'fREW' Schmidt Date: Tue, 9 Nov 2010 01:11:59 +0000 (-0600) Subject: better quoting logic X-Git-Tag: v1.70~3 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4712657d77ba0076a121a8058f648fc1150f2d38;p=dbsrgits%2FSQL-Abstract.git better quoting logic --- diff --git a/lib/SQL/Abstract/Tree.pm b/lib/SQL/Abstract/Tree.pm index 0cceed8..b9815dc 100644 --- a/lib/SQL/Abstract/Tree.pm +++ b/lib/SQL/Abstract/Tree.pm @@ -448,12 +448,12 @@ sub fill_in_placeholder { if ($self->fill_in_placeholders) { my $val = shift @{$bindargs} || ''; - $val =~ s/^(')(.*)(')$/$2/; - my ($lquo, $rquo) = ($1 || '', $3 || ''); + my $quoted = $val =~ s/^(['"])(.*)\1$/$2/; my ($left, $right) = @{$self->placeholder_surround}; $val =~ s/\\/\\\\/g; $val =~ s/'/\\'/g; - return qq($left$lquo$val$rquo$right) + $val = qq('$val') if $quoted; + return qq($left$val$right) } return '?' }