Prepare for new SQLA release
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / Storage / DBIHacks.pm
index 2d9fd35..331474f 100644 (file)
@@ -97,6 +97,7 @@ sub _adjust_select_args_for_complex_prefetch {
   }
 
   # construct the inner $from for the subquery
+  # we need to prune first, because this will determine if we need a group_bu below
   my $inner_from = $self->_prune_unused_joins ($from, $inner_select, $where, $inner_attrs);
 
   # if a multi-type join was needed in the subquery - add a group_by to simulate the
@@ -458,13 +459,17 @@ sub _strip_cond_qualifiers {
        for (my $i = 0; $i < @cond; $i++) {
         my $entry = $cond[$i];
         my $hash;
-        if (ref $entry eq 'HASH') {
+        my $ref = ref $entry;
+        if ($ref eq 'HASH' or $ref eq 'ARRAY') {
           $hash = $self->_strip_cond_qualifiers($entry);
         }
-        else {
+        elsif (! $ref) {
           $entry =~ /([^.]+)$/;
           $hash->{$1} = $cond[++$i];
         }
+        else {
+          $self->throw_exception ("_strip_cond_qualifiers() is unable to handle a condition reftype $ref");
+        }
         push @{$cond->{-and}}, $hash;
       }
     }