From: Peter Rabbitson Date: Sat, 26 Jan 2013 16:25:33 +0000 (+0100) Subject: Unset collapse in even more cases X-Git-Tag: v0.08240~18 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a59246c38852d59fa8ba917fb278aefea43da1e1;hp=7d5371dc9046fa07a4cd0573f00df8479f4067be;p=dbsrgits%2FDBIx-Class.git Unset collapse in even more cases --- diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index 5ec88d0..b5099f9 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -3446,7 +3446,10 @@ sub _resolved_attrs { push @{ $attrs->{as} }, (map { $_->[1] } @prefetch); } - $attrs->{_single_object_inflation} = ! List::Util::first { $_ =~ /\./ } @{$attrs->{as}}; + if ( ! List::Util::first { $_ =~ /\./ } @{$attrs->{as}} ) { + $attrs->{_single_object_inflation} = 1; + $attrs->{collapse} = 0; + } # run through the resulting joinstructure (starting from our current slot) # and unset collapse if proven unnesessary @@ -3604,7 +3607,7 @@ sub _merge_joinpref_attr { $seen_keys->{$import_key} = 1; # don't merge the same key twice } - return $orig; + return @$orig ? $orig : (); } { diff --git a/lib/DBIx/Class/Storage/DBIHacks.pm b/lib/DBIx/Class/Storage/DBIHacks.pm index a8eca16..eaa41c4 100644 --- a/lib/DBIx/Class/Storage/DBIHacks.pm +++ b/lib/DBIx/Class/Storage/DBIHacks.pm @@ -67,7 +67,7 @@ sub _adjust_select_args_for_complex_prefetch { my ($self, $from, $select, $where, $attrs) = @_; $self->throw_exception ('Nothing to prefetch... how did we get here?!') - if not @{$attrs->{_prefetch_selector_range}}; + if not @{$attrs->{_prefetch_selector_range}||[]}; $self->throw_exception ('Complex prefetches are not supported on resultsets with a custom from attribute') if (ref $from ne 'ARRAY' || ref $from->[0] ne 'HASH' || ref $from->[1] ne 'ARRAY');