From: Matt S Trout Date: Sat, 21 Jan 2006 22:34:31 +0000 (+0000) Subject: Nuked _select_columns, the last vestige of class-based evil X-Git-Tag: v0.05005~117^2~19 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a9433341369da32eafd7509f49477b44c84bcbeb;p=dbsrgits%2FDBIx-Class.git Nuked _select_columns, the last vestige of class-based evil --- diff --git a/lib/DBIx/Class/CDBICompat/LazyLoading.pm b/lib/DBIx/Class/CDBICompat/LazyLoading.pm index ff235e2..8a7c17b 100644 --- a/lib/DBIx/Class/CDBICompat/LazyLoading.pm +++ b/lib/DBIx/Class/CDBICompat/LazyLoading.pm @@ -3,8 +3,11 @@ package 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, { cols => [ $self->columns('Essential') ] }); + return $rs; } sub get_column { diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index fea1533..cfe45ce 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -43,10 +43,11 @@ sub new { $attrs = Storable::dclone($attrs || {}); # { %{ $attrs || {} } }; my %seen; my $alias = ($attrs->{alias} ||= 'me'); - if (!$attrs->{select}) { + if ($attrs->{cols} || !$attrs->{select}) { + delete $attrs->{as} if $attrs->{cols}; my @cols = ($attrs->{cols} ? @{delete $attrs->{cols}} - : $source->result_class->_select_columns); + : $source->columns); $attrs->{select} = [ map { m/\./ ? $_ : "${alias}.$_" } @cols ]; } $attrs->{as} ||= [ map { m/^$alias\.(.*)$/ ? $1 : $_ } @{$attrs->{select}} ]; diff --git a/lib/DBIx/Class/ResultSourceInstance.pm b/lib/DBIx/Class/ResultSourceInstance.pm index e9fd560..7320826 100644 --- a/lib/DBIx/Class/ResultSourceInstance.pm +++ b/lib/DBIx/Class/ResultSourceInstance.pm @@ -17,10 +17,6 @@ sub add_columns { } } -sub _select_columns { - return shift->result_source_instance->columns; -} - sub has_column { my ($self, $column) = @_; return $self->result_source_instance->has_column($column);