[Bast-commits] r9044 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Wed Mar 24 10:33:03 GMT 2010
Author: ribasushi
Date: 2010-03-24 10:33:03 +0000 (Wed, 24 Mar 2010)
New Revision: 9044
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
Log:
Clearer 'no such rel' errors, correct exception on pkless prefetch
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2010-03-24 10:27:36 UTC (rev 9043)
+++ DBIx-Class/0.08/trunk/Changes 2010-03-24 10:33:03 UTC (rev 9044)
@@ -16,6 +16,7 @@
whenever possible
- Add has_relationship method to row objects
- Fix regression in set_column on PK-less objects
+ - Better error text on malformed/missing relationships
- Add POD about the significance of PK columns
- Fix for SQLite to ignore the (unsupported) { for => ... }
attribute
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2010-03-24 10:27:36 UTC (rev 9043)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm 2010-03-24 10:33:03 UTC (rev 9044)
@@ -1007,7 +1007,7 @@
# without having to contruct the full hash
if (keys %collapse) {
- my %pri = map { ($_ => 1) } $self->result_source->primary_columns;
+ my %pri = map { ($_ => 1) } $self->result_source->_pri_cols;
foreach my $i (0 .. $#construct_as) {
next if defined($construct_as[$i][0]); # only self table
if (delete $pri{$construct_as[$i][1]}) {
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2010-03-24 10:27:36 UTC (rev 9043)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSource.pm 2010-03-24 10:33:03 UTC (rev 9044)
@@ -523,8 +523,8 @@
my $self = shift;
my @pcols = $self->primary_columns
or $self->throw_exception (sprintf(
- 'Operation requires a primary key to be declared on %s via set_primary_key',
- ref $self,
+ "Operation requires a primary key to be declared on '%s' via set_primary_key",
+ $self->source_name,
));
return @pcols;
}
@@ -1242,7 +1242,7 @@
for my $rel (keys %$join) {
my $rel_info = $self->relationship_info($rel)
- or $self->throw_exception("No such relationship ${rel}");
+ or $self->throw_exception("No such relationship '$rel' on " . $self->source_name);
my $force_left = $parent_force_left;
$force_left ||= lc($rel_info->{attrs}{join_type}||'') eq 'left';
@@ -1272,7 +1272,7 @@
);
my $rel_info = $self->relationship_info($join)
- or $self->throw_exception("No such relationship ${join}");
+ or $self->throw_exception("No such relationship $join on " . $self->source_name);
my $rel_src = $self->related_source($join);
return [ { $as => $rel_src->from,
@@ -1440,7 +1440,7 @@
my $as = shift @{$p->{-join_aliases}};
my $rel_info = $self->relationship_info( $pre );
- $self->throw_exception( $self->name . " has no such relationship '$pre'" )
+ $self->throw_exception( $self->source_name . " has no such relationship '$pre'" )
unless $rel_info;
my $as_prefix = ($alias =~ /^.*?\.(.+)$/ ? $1.'.' : '');
my $rel_source = $self->related_source($pre);
@@ -1501,7 +1501,7 @@
sub related_source {
my ($self, $rel) = @_;
if( !$self->has_relationship( $rel ) ) {
- $self->throw_exception("No such relationship '$rel'");
+ $self->throw_exception("No such relationship '$rel' on " . $self->source_name);
}
return $self->schema->source($self->relationship_info($rel)->{source});
}
@@ -1523,7 +1523,7 @@
sub related_class {
my ($self, $rel) = @_;
if( !$self->has_relationship( $rel ) ) {
- $self->throw_exception("No such relationship '$rel'");
+ $self->throw_exception("No such relationship '$rel' on " . $self->source_name);
}
return $self->schema->class($self->relationship_info($rel)->{source});
}
More information about the Bast-commits
mailing list