X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource.pm;h=0094fa4c3a21378738b43e2fdec598eed83cb45f;hb=9be099c30d802c26df562ce1f187e4a43b09f40b;hp=89bc6fffbc51282717e925cb2d0e2ef83a5090b6;hpb=e0cdf2cbe02e576686d9281c1eaac8456086cf39;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index 89bc6ff..0094fa4 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -29,6 +29,8 @@ DBIx::Class::ResultSource - Result source object A ResultSource is a component of a schema from which results can be directly retrieved, most usually a table (see L) +Basic view support also exists, see L<. + =head1 METHODS =pod @@ -123,8 +125,12 @@ L. =item default_value Set this to the default value which will be inserted into a column -by the database. Can contain either a value or a function. This is -currently only used by L. +by the database. Can contain either a value or a function (use a +reference to a scalar e.g. C<\'now()'> if you want a function). This +is currently only used by L. + +See the note on L for more information about possible +issues related to db-side default values. =item sequence @@ -1014,9 +1020,6 @@ sub reverse_relationship_info { $ret->{$otherrel} = $otherrel_info; } } -use Data::Dumper; -#warn "return for reverse_relationship_info called on ".$self->name." for $rel:\n"; -#warn Dumper($ret); return $ret; } @@ -1086,12 +1089,16 @@ sub resolve_join { $seen ||= {}; $force_left ||= { force => 0 }; if (ref $join eq 'ARRAY') { - return map { $self->resolve_join($_, $alias, $seen) } @$join; + return + map { + local $force_left->{force} = $force_left->{force}; + $self->resolve_join($_, $alias, $seen, $force_left); + } @$join; } elsif (ref $join eq 'HASH') { return map { my $as = ($seen->{$_} ? $_.'_'.($seen->{$_}+1) : $_); - local $force_left->{force}; + local $force_left->{force} = $force_left->{force}; ( $self->resolve_join($_, $alias, $seen, $force_left), $self->related_source($_)->resolve_join( @@ -1197,7 +1204,11 @@ sub resolve_condition { #warn "$self $k $for $v"; unless ($for->has_column_loaded($v)) { if ($for->in_storage) { - $self->throw_exception("Column ${v} not loaded on ${for} trying to resolve relationship"); + $self->throw_exception( + "Column ${v} not loaded or not passed to new() prior to insert()" + ." on ${for} trying to resolve relationship (maybe you forgot " + ."to call ->reload_from_storage to get defaults from the db)" + ); } return $UNRESOLVABLE_CONDITION; }