[Bast-commits] r3643 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class t
matthewt at dev.catalyst.perl.org
matthewt at dev.catalyst.perl.org
Fri Aug 3 22:01:49 GMT 2007
Author: matthewt
Date: 2007-08-03 22:01:49 +0100 (Fri, 03 Aug 2007)
New Revision: 3643
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
DBIx-Class/0.08/trunk/t/67pager.t
Log:
add default_resultset_attributes entry to Schema
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2007-08-03 18:52:16 UTC (rev 3642)
+++ DBIx-Class/0.08/trunk/Changes 2007-08-03 21:01:49 UTC (rev 3643)
@@ -1,5 +1,6 @@
Revision history for DBIx::Class
+ - add default_resultset_attributes entry to Schema
- optimisation in DBI::Cursor to check software_limit before falling
back to base Cursor->all
- fix bug with create_multi not inserting non-storage objects
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2007-08-03 18:52:16 UTC (rev 3642)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2007-08-03 21:01:49 UTC (rev 3643)
@@ -988,7 +988,11 @@
) if scalar @_;
return $self->resultset_class->new(
- $self, $self->{resultset_attributes}
+ $self,
+ {
+ %{$self->{resultset_attributes}},
+ %{$self->schema->default_resultset_attributes}
+ },
);
}
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2007-08-03 18:52:16 UTC (rev 3642)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Schema.pm 2007-08-03 21:01:49 UTC (rev 3643)
@@ -17,6 +17,7 @@
__PACKAGE__->mk_classdata('storage');
__PACKAGE__->mk_classdata('exception_action');
__PACKAGE__->mk_classdata('stacktrace' => $ENV{DBIC_TRACE} || 0);
+__PACKAGE__->mk_classdata('default_resultset_attributes' => {});
=head1 NAME
Modified: DBIx-Class/0.08/trunk/t/67pager.t
===================================================================
--- DBIx-Class/0.08/trunk/t/67pager.t 2007-08-03 18:52:16 UTC (rev 3642)
+++ DBIx-Class/0.08/trunk/t/67pager.t 2007-08-03 21:01:49 UTC (rev 3643)
@@ -1,14 +1,12 @@
use strict;
use warnings;
-use Test::More;
+use Test::More qw(no_plan);
use lib qw(t/lib);
use DBICTest;
my $schema = DBICTest->init_schema();
-plan tests => 13;
-
# first page
my $it = $schema->resultset("CD")->search(
{},
@@ -76,3 +74,11 @@
)->search( undef, { order_by => 'title' } );
is( $it->count, 2, "chained searches paging ok" );
+
+my $p = sub { $schema->resultset("CD")->page(1)->pager->entries_per_page; };
+
+is($p->(), 10, 'default rows is 10');
+
+$schema->default_resultset_attributes({ rows => 5 });
+
+is($p->(), 5, 'default rows is 5');
More information about the Bast-commits
mailing list