# in ::Relationship::Base::search_related (the row method), and furthermore
# the relationship is of the 'single' type. This means that the condition
# provided by the relationship (already attached to $self) is sufficient,
- # as there can be only one row in the databse that would satisfy the
+ # as there can be only one row in the databse that would satisfy the
# relationship
}
else {
my $tmp_attrs = { %$attrs };
- # take off any limits, record_filter is cdbi, and no point of ordering a count
+ # take off any limits, record_filter is cdbi, and no point of ordering a count
delete $tmp_attrs->{$_} for (qw/select as rows offset order_by record_filter/);
# overwrite the selector (supplied by the storage)
shift->set_cache(undef);
}
+=head2 is_paginated
+
+Returns true if the resultset has been paginated
+
+=cut
+
+sub is_paginated {
+ my ($self) = @_;
+ return !!$self->{attrs}{page};
+}
+
=head2 related_resultset
=over 4
}];
my $seen = { %{$attrs->{seen_join} || {} } };
- my $jpath = ($attrs->{seen_join} && keys %{$attrs->{seen_join}})
- ? $from->[-1][0]{-join_path}
+ my $jpath = ($attrs->{seen_join} && keys %{$attrs->{seen_join}})
+ ? $from->[-1][0]{-join_path}
: [];
# even though it doesn't make much sense, this is what pre 081xx has
# been doing
if (my $page = delete $attrs->{page}) {
- $attrs->{offset} =
+ $attrs->{offset} =
($attrs->{rows} * ($page - 1))
+
($attrs->{offset} || 0)
=back
-Which column(s) to order the results by.
+Which column(s) to order the results by.
[The full list of suitable values is documented in
L<SQL::Abstract/"ORDER BY CLAUSES">; the following is a summary of
=over 4
-=item *
+=item *
Prefetch uses the L</cache> to populate the prefetched relationships. This
may or may not be what you want.
-=item *
+=item *
If you specify a condition on a prefetched relationship, ONLY those
rows that match the prefetched condition will be fetched into that relationship.
--- /dev/null
+use strict;\r
+use warnings;\r
+\r
+use lib qw(t/lib);\r
+use Test::More;\r
+use Test::Exception;\r
+use DBICTest;\r
+\r
+my $schema = DBICTest->init_schema();\r
+\r
+my $tkfks = $schema->resultset('Artist');\r
+\r
+ok !$tkfks->is_paginated, 'vanilla resultset is not paginated';\r
+\r
+my $paginated = $tkfks->search(undef, { page => 5 });\r
+ok $paginated->is_paginated, 'resultset is paginated now';\r
+\r
+done_testing;\r
+\r