From: Matt S Trout Date: Sun, 7 Apr 2019 23:45:01 +0000 (+0000) Subject: clean up expansion X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c79c67d74de3f0bd12df6579a597fa9507f10142;p=scpubgit%2FQ-Branch.git clean up expansion --- diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index 9f92b00..3e062fb 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -61,14 +61,18 @@ sub _expand_statement { my ($self, $type, $args) = @_; my $ec = $self->{expand_clause}; return +{ "-${type}" => +{ - map +($_ => (do { + map { my $val = $args->{$_}; if (defined($val) and my $exp = $ec->{"${type}.$_"}) { - $self->$exp($val); + if ((my (@exp) = $self->$exp($val)) == 1) { + ($_ => $exp[0]) + } else { + @exp + } } else { - $val; + ($_ => $val) } - })), sort keys %$args + } sort keys %$args } }; }