[Bast-commits] r7860 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class
t/inflate
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Thu Nov 12 00:35:36 GMT 2009
Author: ribasushi
Date: 2009-11-12 00:35:36 +0000 (Thu, 12 Nov 2009)
New Revision: 7860
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
DBIx-Class/0.08/trunk/t/inflate/hri.t
Log:
Fix find on resultset with custom result_class
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2009-11-11 23:46:07 UTC (rev 7859)
+++ DBIx-Class/0.08/trunk/Changes 2009-11-12 00:35:36 UTC (rev 7860)
@@ -30,6 +30,8 @@
- Remove some IN workarounds, and require a recent version of
SQLA instead
- Improvements to populate's handling of mixed scalarref values
+ - Fixed regression losing result_class after $rs->find (introduced
+ in 0.08108)
- POD improvements
0.08112 2009-09-21 10:57:00 (UTC)
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-11-11 23:46:07 UTC (rev 7859)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2009-11-12 00:35:36 UTC (rev 7860)
@@ -357,9 +357,9 @@
}
my $rs = (ref $self)->new($self->result_source, $new_attrs);
- if ($rows) {
- $rs->set_cache($rows);
- }
+
+ $rs->set_cache($rows) if ($rows);
+
return $rs;
}
@@ -530,7 +530,7 @@
}
# Run the query
- my $rs = $self->search ($query, $attrs);
+ my $rs = $self->search ($query, {result_class => $self->result_class, %$attrs});
if (keys %{$rs->_resolved_attrs->{collapse}}) {
my $row = $rs->next;
carp "Query returned more than one row" if $rs->next;
Modified: DBIx-Class/0.08/trunk/t/inflate/hri.t
===================================================================
--- DBIx-Class/0.08/trunk/t/inflate/hri.t 2009-11-11 23:46:07 UTC (rev 7859)
+++ DBIx-Class/0.08/trunk/t/inflate/hri.t 2009-11-12 00:35:36 UTC (rev 7860)
@@ -1,7 +1,7 @@
use strict;
-use warnings;
+use warnings;
-use Test::More qw(no_plan);
+use Test::More;
use lib qw(t/lib);
use DBICTest;
my $schema = DBICTest->init_schema();
@@ -9,7 +9,7 @@
# Under some versions of SQLite if the $rs is left hanging around it will lock
# So we create a scope here cos I'm lazy
{
- my $rs = $schema->resultset('CD');
+ my $rs = $schema->resultset('CD')->search ({}, { order_by => 'cdid' });
# get the defined columns
my @dbic_cols = sort $rs->result_source->columns;
@@ -23,9 +23,11 @@
my @hashref_cols = sort keys %$datahashref1;
is_deeply( \@dbic_cols, \@hashref_cols, 'returned columns' );
+
+ my $cd1 = $rs->find ({cdid => 1});
+ is_deeply ( $cd1, $datahashref1, 'first/find return the same thing');
}
-
sub check_cols_of {
my ($dbic_obj, $datahashref) = @_;
@@ -135,3 +137,5 @@
[{ $artist->get_columns, cds => [] }],
'nested has_many prefetch without entries'
);
+
+done_testing;
More information about the Bast-commits
mailing list