X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSource.pm;h=a0263397cfd5c53e90c6b46677380b93a40a9a86;hb=cb136e67f71c272de046dfab5cec183f78cb5e08;hp=d23c765a509f4a2f9d94c867d61d8de9de55bfa4;hpb=d2f3e87bbb670790a5572e1f7b92f33cc57585ab;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSource.pm b/lib/DBIx/Class/ResultSource.pm index d23c765..a026339 100644 --- a/lib/DBIx/Class/ResultSource.pm +++ b/lib/DBIx/Class/ResultSource.pm @@ -143,6 +143,12 @@ generate a new key value. If not specified, L will attempt to retrieve the name of the sequence from the database automatically. +=item auto_nextval + +Set this to a true value for a column whose value is retrieved +automatically from an oracle sequence. If you do not use an oracle +trigger to get the nextval, you have to set sequence as well. + =item extra This is used by L and L @@ -640,7 +646,7 @@ sub reverse_relationship_info { my $otherrel_info = $othertable->relationship_info($otherrel); my $back = $othertable->related_source($otherrel); - next unless $back->name eq $self->name; + next unless $back->source_name eq $self->source_name; my @othertestconds; @@ -899,6 +905,16 @@ sub resolve_prefetch { $self->throw_exception( "Can't prefetch has_many ${pre} (join cond too complex)") unless ref($rel_info->{cond}) eq 'HASH'; + my $dots = @{[$as_prefix =~ m/\./g]} + 1; # +1 to match the ".${as_prefix}" + 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" + )); + } #my @col = map { (/^self\.(.+)$/ ? ("${as_prefix}.$1") : ()); } # values %{$rel_info->{cond}}; $collapse->{".${as_prefix}${pre}"} = [ $rel_source->primary_columns ]; @@ -980,7 +996,9 @@ but is cached from then on unless resultset_class changes. Set the class of the resultset, this is useful if you want to create your own resultset methods. Create your own class derived from -L, and set it here. +L, and set it here. If called with no arguments, +this method returns the name of the existing resultset class, if one +exists. =head2 resultset_attributes