From: Peter Rabbitson Date: Sat, 12 Dec 2009 23:21:05 +0000 (+0000) Subject: Isolate prefetch heads using RNO with a subquery X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6102431133d7cab3b4b5701dfc482b5c147a737a;p=dbsrgits%2FDBIx-Class-Historic.git Isolate prefetch heads using RNO with a subquery --- diff --git a/lib/DBIx/Class/Storage/DBI.pm b/lib/DBIx/Class/Storage/DBI.pm index d69af71..dd8616d 100644 --- a/lib/DBIx/Class/Storage/DBI.pm +++ b/lib/DBIx/Class/Storage/DBI.pm @@ -1774,11 +1774,24 @@ sub _select_args { my @limit; - # see if we need to tear the prefetch apart (either limited has_many or grouped prefetch) - # otherwise delegate the limiting to the storage, unless software limit was requested + # see if we need to tear the prefetch apart otherwise delegate the limiting to the + # storage, unless software limit was requested if ( + #limited has_many ( $attrs->{rows} && keys %{$attrs->{collapse}} ) || + # limited prefetch with RNO subqueries + ( + $attrs->{rows} + && + $sql_maker->limit_dialect eq 'RowNumberOver' + && + $attrs->{_prefetch_select} + && + @{$attrs->{_prefetch_select}} + ) + || + # grouped prefetch ( $attrs->{group_by} && @{$attrs->{group_by}} @@ -1788,7 +1801,6 @@ sub _select_args { @{$attrs->{_prefetch_select}} ) ) { - ($ident, $select, $where, $attrs) = $self->_adjust_select_args_for_complex_prefetch ($ident, $select, $where, $attrs); }