$sql,
$quoted_rs_alias,
$order_by_requested,
- ) if ($order_by_requested || ($mid_sel ne $out_sel));
+ ) if ( ($offset && $order_by_requested) || ($mid_sel ne $out_sel) );
return $sql;
}
$table = $self->_quote($table);
}
- local $self->{rownum_hack_count} = 1
- if (defined $rest[0] && $self->{limit_dialect} eq 'RowNum');
@rest = (-1) unless defined $rest[0];
croak "LIMIT 0 Does Not Compute" if $rest[0] == 0;
# and anyway, SQL::Abstract::Limit will cause a barf if we don't first
croak "Malformed select argument - too many keys in hash: " . join (',', keys %$fields );
}
+ $func =~ s/^\-+//; # strip leading dash, at some point the dash itself should become mandatory
+
if (lc ($func) eq 'distinct' && ref $args eq 'ARRAY' && @$args > 1) {
croak (
'The select => { distinct => ... } syntax is not supported for multiple columns.'
my $sql = '';
- if (my $g = $self->_recurse_fields($arg->{group_by}, { no_rownum_hack => 1 }) ) {
+ if (my $g = $self->_recurse_fields($arg->{group_by}) ) {
$sql .= $self->_sqlcase(' group by ') . $g;
}
]);
}
+sub _order_by_chunks {
+ my ($self, $arg) = @_;
+ if ( # non-empty hash with neither an -asc or a -desc
+ ref $arg eq 'HASH'
+ &&
+ keys %$arg
+ &&
+ ! exists $arg->{-desc}
+ &&
+ ! exists $arg->{-asc}
+ ) {
+ return $self->_recurse_fields ($arg);
+ }
+
+ return $self->SUPER::_order_by_chunks ($arg);
+}
+
sub _table {
my ($self, $from) = @_;
if (ref $from eq 'ARRAY') {