[Bast-commits] r6949 -
DBIx-Class/0.08/branches/unresolvable_prefetch/lib/DBIx/Class
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Thu Jul 2 22:14:10 GMT 2009
Author: ribasushi
Date: 2009-07-02 22:14:09 +0000 (Thu, 02 Jul 2009)
New Revision: 6949
Modified:
DBIx-Class/0.08/branches/unresolvable_prefetch/lib/DBIx/Class/ResultSource.pm
DBIx-Class/0.08/branches/unresolvable_prefetch/lib/DBIx/Class/Row.pm
Log:
Apparent fix - simply delay the in_storage flagging of the main object until all prefetched objects are inflated. The rest of the changes are just cosmetics, preparing for the collapse_result rewrite
Modified: DBIx-Class/0.08/branches/unresolvable_prefetch/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/branches/unresolvable_prefetch/lib/DBIx/Class/ResultSource.pm 2009-07-02 20:55:02 UTC (rev 6948)
+++ DBIx-Class/0.08/branches/unresolvable_prefetch/lib/DBIx/Class/ResultSource.pm 2009-07-02 22:14:09 UTC (rev 6949)
@@ -1193,7 +1193,6 @@
sub _resolve_condition {
my ($self, $cond, $as, $for) = @_;
- #warn %$cond;
if (ref $cond eq 'HASH') {
my %ret;
foreach my $k (keys %{$cond}) {
@@ -1234,7 +1233,7 @@
} elsif (ref $cond eq 'ARRAY') {
return [ map { $self->_resolve_condition($_, $as, $for) } @$cond ];
} else {
- die("Can't handle this yet :(");
+ die("Can't handle condition $cond yet :(");
}
}
Modified: DBIx-Class/0.08/branches/unresolvable_prefetch/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/branches/unresolvable_prefetch/lib/DBIx/Class/Row.pm 2009-07-02 20:55:02 UTC (rev 6948)
+++ DBIx-Class/0.08/branches/unresolvable_prefetch/lib/DBIx/Class/Row.pm 2009-07-02 22:14:09 UTC (rev 6949)
@@ -1053,7 +1053,6 @@
my $new = {
_source_handle => $source_handle,
_column_data => $me,
- _in_storage => 1
};
bless $new, (ref $class || $class);
@@ -1065,14 +1064,25 @@
unless $pre_source;
if (ref($pre_val->[0]) eq 'ARRAY') { # multi
my @pre_objects;
- foreach my $pre_rec (@$pre_val) {
- unless ($pre_source->primary_columns == grep { exists $pre_rec->[0]{$_}
- and defined $pre_rec->[0]{$_} } $pre_source->primary_columns) {
- next;
+
+ for my $me_pref (@$pre_val) {
+
+ # the collapser currently *could* return bogus elements with all
+ # columns set to undef
+ my $has_def;
+ for (values %{$me_pref->[0]}) {
+ if (defined $_) {
+ $has_def++;
+ last;
+ }
}
- push(@pre_objects, $pre_source->result_class->inflate_result(
- $pre_source, @{$pre_rec}));
+ next unless $has_def;
+
+ push @pre_objects, $pre_source->result_class->inflate_result(
+ $pre_source, @$me_pref
+ );
}
+
$new->related_resultset($pre)->set_cache(\@pre_objects);
} elsif (defined $pre_val->[0]) {
my $fetched;
@@ -1095,6 +1105,8 @@
$new->related_resultset($pre)->set_cache([ $fetched ]);
}
}
+
+ $new->in_storage (1);
return $new;
}
More information about the Bast-commits
mailing list