X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FCDBICompat%2FLazyLoading.pm;h=b7d3633219be41f6584e0093f919363d4a31bffb;hb=237455da90aaf390eece4cce1327baaedb20db4b;hp=6a33eff2393d3c3a96ca800a8282be8206967222;hpb=8d5134b09734852f9c11a3fd6b1c8f6551637b53;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/CDBICompat/LazyLoading.pm b/lib/DBIx/Class/CDBICompat/LazyLoading.pm index 6a33eff..b7d3633 100644 --- a/lib/DBIx/Class/CDBICompat/LazyLoading.pm +++ b/lib/DBIx/Class/CDBICompat/LazyLoading.pm @@ -1,10 +1,14 @@ -package DBIx::Class::CDBICompat::LazyLoading; +package # hide from PAUSE + DBIx::Class::CDBICompat::LazyLoading; use strict; use warnings; -sub _select_columns { - return shift->columns('Essential'); +sub resultset_instance { + my $self = shift; + my $rs = $self->next::method(@_); + $rs = $rs->search(undef, { columns => [ $self->columns('Essential') ] }); + return $rs; } sub get_column { @@ -15,7 +19,12 @@ sub get_column { && $_ ne 'All' } keys %{ $self->_column_groups || {} }); } - $self->NEXT::get_column(@_[1..$#_]); + $self->next::method(@_[1..$#_]); +} + +sub _ident_cond { + my ($class) = @_; + return join(" AND ", map { "$_ = ?" } $class->primary_columns); } sub _flesh { @@ -24,7 +33,8 @@ sub _flesh { my %want; $want{$_} = 1 for map { keys %{$self->_column_groups->{$_}} } @groups; if (my @want = grep { !exists $self->{'_column_data'}{$_} } keys %want) { - my $cursor = $self->storage->select($self->_table_name, \@want, + my $cursor = $self->result_source->storage->select( + $self->result_source->name, \@want, \$self->_ident_cond, { bind => [ $self->_ident_values ] }); #my $sth = $self->storage->select($self->_table_name, \@want, # $self->ident_condition);