From: Matt S Trout Date: Wed, 10 Apr 2019 01:12:50 +0000 (+0000) Subject: Pass all expression stability tests. Verified by: X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e5feec9f0925378912ad77c51469425b0908a310;p=scpubgit%2FQ-Branch.git Pass all expression stability tests. Verified by: SQL_ABSTRACT_TEST_AGAINST=SQL::Abstract::Clauses \ SQL_ABSTRACT_TEST_EXPAND_STABILITY=1 \ PERL5OPT=-MDevel::Dwarn \ prove -j8 -lr t --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index f736487..4a2d3d1 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -1258,6 +1258,8 @@ sub _expand_order_by { return unless defined($arg) and not (ref($arg) eq 'ARRAY' and !@$arg); + return $arg if ref($arg) eq 'HASH' and ($arg->{-op}||[''])->[0] eq ','; + my $expander = sub { my ($self, $dir, $expr) = @_; my @to_expand = ref($expr) eq 'ARRAY' ? @$expr : $expr; @@ -1343,7 +1345,7 @@ sub _table { sub _expand_maybe_list_expr { my ($self, $expr, $default) = @_; - return $expr if ref($expr) eq 'HASH' and (($expr->{-op}||[''])->[0] eq ','); + return $expr if ref($expr) eq 'HASH' and ($expr->{-op}||[''])->[0] eq ','; return +{ -op => [ ',', map $self->expand_expr($_, $default), ref($expr) eq 'ARRAY' ? @$expr : $expr diff --git a/lib/SQL/Abstract/Clauses.pm b/lib/SQL/Abstract/Clauses.pm index bbe1eda..6f311ae 100644 --- a/lib/SQL/Abstract/Clauses.pm +++ b/lib/SQL/Abstract/Clauses.pm @@ -72,6 +72,7 @@ sub _expand_update_clause_update { } sub _expand_update_clause_set { + return $_[1] if ref($_[1]) eq 'HASH' and ($_[1]->{-op}||[''])->[0] eq ','; +(set => shift->_expand_update_set_values(@_)); } @@ -177,6 +178,7 @@ sub insert { sub _expand_insert_clause_values { my ($self, $data) = @_; + return $data if ref($data) eq 'HASH' and $data->{-row}; my ($f_aqt, $v_aqt) = $self->_expand_insert_values($data); return (values => $v_aqt, ($f_aqt ? (fields => $f_aqt) : ())); }