From: Matt S Trout Date: Fri, 5 Apr 2019 00:00:15 +0000 (+0000) Subject: make sketch vaguely work X-Git-Tag: v2.000000~3^2~273 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=25b45941944b6b10a81ee1aaf2c2d6f34bf0a5bf;p=dbsrgits%2FSQL-Abstract.git make sketch vaguely work --- diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index be8bfa8..3b8409e 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -13,8 +13,10 @@ sub register_defaults { my ($self) = @_; $self->{clauses_of}{select} = [ qw(select from where order_by) ]; $self->{expand}{select} = sub { shift->_expand_statement(@_) }; - $self->{render}{select} = sub { shift->_render_statement(@_) }; - $self->{expand_clause}{'select.select'} = '_expand_maybe_list_expr'; + $self->{render}{select} = sub { shift->_render_statement(select => @_) }; + $self->{expand_clause}{'select.select'} = sub { + $_[0]->_expand_maybe_list_expr($_[1], -ident) + }; $self->{expand_clause}{'select.from'} = sub { $_[0]->_expand_maybe_list_expr($_[1], -ident) }; @@ -26,7 +28,7 @@ sub register_defaults { sub _expand_statement { my ($self, $type, $args) = @_; my $ec = $self->{expand_clause}; - return +{ + return +{ "-${type}" => +{ map +($_ => (do { my $val = $args->{$_}; if (defined($val) and my $exp = $ec->{"${type}.$_"}) { @@ -35,7 +37,7 @@ sub _expand_statement { $val; } })), sort keys %$args - }; + } }; } sub _render_statement {