X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FCDBICompat%2FLazyLoading.pm;h=ff235e2b8797f6971a85a5a06c64310c7b6ffb7f;hb=8292706e66edd1a95b3af7796aa013285fc842ef;hp=d15345a6c2811b379b23f6993b4343fb9c78ec63;hpb=244b1ee9eb3a410139b08ec2c44303de7ac104a6;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/CDBICompat/LazyLoading.pm b/lib/DBIx/Class/CDBICompat/LazyLoading.pm index d15345a..ff235e2 100644 --- a/lib/DBIx/Class/CDBICompat/LazyLoading.pm +++ b/lib/DBIx/Class/CDBICompat/LazyLoading.pm @@ -10,12 +10,12 @@ sub _select_columns { sub get_column { my ($self, $col) = @_; if ((ref $self) && (!exists $self->{'_column_data'}{$col}) - && $self->{'_in_database'}) { + && $self->{'_in_storage'}) { $self->_flesh(grep { exists $self->_column_groups->{$_}{$col} && $_ ne 'All' } keys %{ $self->_column_groups || {} }); } - $self->NEXT::get_column(@_[1..$#_]); + $self->next::method(@_[1..$#_]); } sub _flesh { @@ -24,10 +24,14 @@ sub _flesh { my %want; $want{$_} = 1 for map { keys %{$self->_column_groups->{$_}} } @groups; if (my @want = grep { !exists $self->{'_column_data'}{$_} } keys %want) { - my $sth = $self->_get_sth('select', \@want, $self->_table_name, - $self->_ident_cond); - $sth->execute($self->_ident_values); - my @val = $sth->fetchrow_array; + 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); + # Not sure why the first one works and this doesn't :( + my @val = $cursor->next; +#warn "Flesh: ".join(', ', @want, '=>', @val); foreach my $w (@want) { $self->{'_column_data'}{$w} = shift @val; }