From: Matt S Trout Date: Wed, 27 Feb 2019 03:33:33 +0000 (+0000) Subject: expand value node type to bind, remove value render code X-Git-Tag: v2.000000~3^2~415 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16b0a9ea4f2787a4b16147ef179b30fb0173d8aa;p=dbsrgits%2FSQL-Abstract.git expand value node type to bind, remove value render code --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index 62057d0..57186d2 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -186,7 +186,7 @@ sub new { $opt{node_types} = +{ map +("-$_" => '_render_'.$_), - qw(op func value bind ident literal list) + qw(op func bind ident literal list) }; $opt{expand_unary} = {}; @@ -558,12 +558,12 @@ sub _expand_expr { } if (!ref($expr) or Scalar::Util::blessed($expr)) { if (my $d = $Default_Scalar_To) { - return +{ $d => $expr }; + return $self->_expand_expr({ $d => $expr }); } if (my $m = our $Cur_Col_Meta) { return +{ -bind => [ $m, $expr ] }; } - return +{ -value => $expr }; + return +{ -bind => [ undef, $expr ] }; } die "notreached"; } @@ -639,8 +639,8 @@ sub _expand_expr_hashpair { return { -op => [ $op, $v ] }; } } - if ($k eq '-value' and my $m = our $Cur_Col_Meta) { - return +{ -bind => [ $m, $v ] }; + if ($k eq '-value') { + return +{ -bind => [ our $Cur_Col_Meta, $v ] }; } if (my $custom = $self->{expand_unary}{$k}) { return $self->$custom($v); @@ -921,12 +921,6 @@ sub _render_ident { return $self->_convert($self->_quote($ident)); } -sub _render_value { - my ($self, $value) = @_; - - return ($self->_convert('?'), $self->_bindtype(undef, $value)); -} - my %unop_postfix = map +($_ => 1), 'is null', 'is not null', 'asc', 'desc',