From: Peter Rabbitson Date: Sat, 30 May 2009 08:10:38 +0000 (+0000) Subject: Do not join hash order conditions early X-Git-Tag: v1.70~152 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e9bd3547cba33dc11c5bb5d6ed4714b657b4d8d2;p=dbsrgits%2FSQL-Abstract.git Do not join hash order conditions early --- diff --git a/lib/SQL/Abstract.pm b/lib/SQL/Abstract.pm index ad17722..7a6748e 100644 --- a/lib/SQL/Abstract.pm +++ b/lib/SQL/Abstract.pm @@ -861,26 +861,25 @@ sub _order_by_chunks { my $direction = $1; - my (@sql, @bind); + my @ret; for my $c ($self->_order_by_chunks ($val)) { - - + my ($sql, @bind); $self->_SWITCH_refkind ($c, { SCALAR => sub { - push @sql, $c + $sql = $c; }, ARRAYREF => sub { - my ($s, @b) = @$c; - push @sql, $s; - push @bind, @b; + ($sql, @bind) = @$c; }, }); - } - my $sql = join ', ', map { $_ . ' ' . $self->_sqlcase($direction) } @sql; + $sql = $sql . ' ' . $self->_sqlcase($direction); + + push @ret, [ $sql, @bind]; + } - return [$sql, @bind]; + return @ret; }, }); }