PK::Auto tweak
Matt S Trout [Sun, 19 Feb 2006 20:30:07 +0000 (20:30 +0000)]
lib/DBIx/Class/PK/Auto.pm
lib/DBIx/Class/Relationship/Base.pm
t/cdbi-t/12-filter.t

index f79eca5..64c8c83 100644 (file)
@@ -58,7 +58,9 @@ sub insert {
   $self->throw_exception( "More than one possible key found for auto-inc on ".ref $self )
     if defined $too_many;
 
-  my $id = $self->result_source->storage->last_insert_id($self->result_source,$pri);
+  my $storage = $self->result_source->storage;
+  $self->throw_exception( "Missing primary key but Storage doesn't support last_insert_id" ) unless $storage->can('last_insert_id');
+  my $id = $storage->last_insert_id($self->result_source,$pri);
   $self->throw_exception( "Can't get last insert id" ) unless $id;
   $self->store_column($pri => $id);
 
index 6f25075..c048fc9 100644 (file)
@@ -202,7 +202,7 @@ sub delete_related {
 
 Returns a L<DBIx::Class::ResultSet> for the relationship named $name.
 
-  $rs = My::Table->related_resultset('related_table');
+  $rs = $obj->related_resultset('related_table');
 
 =cut
 
index c161602..979ad56 100644 (file)
@@ -164,6 +164,8 @@ package main;
 
 Actor->iterator_class('Class::DBI::My::Iterator');
 
+delete $film->{related_resultsets};
+
 {
        my @acts = $film->actors->slice(1, 2);
        is @acts, 2, "Slice gives 2 results";