From: Matt S Trout Date: Sun, 19 Feb 2006 20:30:07 +0000 (+0000) Subject: PK::Auto tweak X-Git-Tag: v0.06000~61^2~23 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fefe28169210318416848240153381885762b08f;p=dbsrgits%2FDBIx-Class.git PK::Auto tweak --- diff --git a/lib/DBIx/Class/PK/Auto.pm b/lib/DBIx/Class/PK/Auto.pm index f79eca5..64c8c83 100644 --- a/lib/DBIx/Class/PK/Auto.pm +++ b/lib/DBIx/Class/PK/Auto.pm @@ -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); diff --git a/lib/DBIx/Class/Relationship/Base.pm b/lib/DBIx/Class/Relationship/Base.pm index 6f25075..c048fc9 100644 --- a/lib/DBIx/Class/Relationship/Base.pm +++ b/lib/DBIx/Class/Relationship/Base.pm @@ -202,7 +202,7 @@ sub delete_related { Returns a L for the relationship named $name. - $rs = My::Table->related_resultset('related_table'); + $rs = $obj->related_resultset('related_table'); =cut diff --git a/t/cdbi-t/12-filter.t b/t/cdbi-t/12-filter.t index c161602..979ad56 100644 --- a/t/cdbi-t/12-filter.t +++ b/t/cdbi-t/12-filter.t @@ -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";