X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource.pm;h=f3d67927950a81ffc163d09349248d133cbcc300;hb=bb90689c4ee23f5407732eda3937553247285b0d;hp=2c716408eeb307f558c519e1964d4c68a421a02b;hpb=370f2ba2727791641c350a20e4fd09469503dbae;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 2c71640..f3d6792 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -825,6 +825,8 @@ a related conditional from that object. =cut +our $UNRESOLVABLE_CONDITION = \'1 = 0'; + sub resolve_condition { my ($self, $cond, $as, $for) = @_; #warn %$cond; @@ -843,7 +845,7 @@ sub resolve_condition { if ($for->in_storage) { $self->throw_exception("Column ${v} not loaded on ${for} trying to reolve relationship"); } - return [ \'1 = 0' ]; + return $UNRESOLVABLE_CONDITION; } $ret{$k} = $for->get_column($v); #$ret{$k} = $for->get_column($v) if $for->has_column_loaded($v); @@ -959,11 +961,16 @@ sub resolve_prefetch { if (my ($fail) = grep { @{[$_ =~ m/\./g]} == $dots } keys %{$collapse}) { my ($last) = ($fail =~ /([^\.]+)$/); - $self->throw_exception( - "Can't prefetch multiple has_many rels ${last} and ${pre}" - .(length($as_prefix) ? "at the same level (${as_prefix})" - : "at top level" - )); + carp ( + "Prefetching multiple has_many rels ${last} and ${pre} " + .(length($as_prefix) + ? "at the same level (${as_prefix}) " + : "at top level " + ) + . 'will currently disrupt both the functionality of $rs->count(), ' + . 'and the amount of objects retrievable via $rs->next(). ' + . 'Use at your own risk.' + ); } #my @col = map { (/^self\.(.+)$/ ? ("${as_prefix}.$1") : ()); } # values %{$rel_info->{cond}};