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
$seen_keys->{$import_key} = 1; # don't merge the same key twice
}
- return $orig;
+ return @$orig ? $orig : ();
}
{
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');