cleanup test by wreis
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / SQLAHacks.pm
index 40bc7a3..c362e91 100644 (file)
@@ -485,6 +485,8 @@ sub _recurse_fields {
       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.'
@@ -575,6 +577,23 @@ sub _order_directions {
   ]);
 }
 
+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') {