X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FResultSet.pm;h=f91676f9c43e6e12ea963d61306712d9f01a63b2;hb=18d80024c95f440cf8a7600f4340ef5247c6b15a;hp=a145dc193178cb015ec2c9aa4638f877e5a566ff;hpb=ea50a38f29794c1ecefb1c70c4c20abf8c4f27f7;p=dbsrgits%2FDBIx-Class.git diff --git a/lib/DBIx/Class/ResultSet.pm b/lib/DBIx/Class/ResultSet.pm index a145dc1..f91676f 100644 --- a/lib/DBIx/Class/ResultSet.pm +++ b/lib/DBIx/Class/ResultSet.pm @@ -1796,7 +1796,12 @@ sub populate { } else { my ($first, @rest) = @$data; - my @names = grep {!ref $first->{$_}} keys %$first; + require overload; + my @names = grep { + (not ref $first->{$_}) || (ref $first->{$_} eq 'SCALAR') || + (overload::Method($first->{$_}, '""')) + } keys %$first; + my @rels = grep { $self->result_source->has_relationship($_) } keys %$first; my @pks = $self->result_source->primary_columns; @@ -1845,7 +1850,7 @@ sub populate { foreach my $rel (@rels) { next unless $item->{$rel} && ref $item->{$rel} eq "ARRAY"; - my $parent = $self->find(map {{$_=>$item->{$_}} } @pks) + my $parent = $self->find({map { $_ => $item->{$_} } @pks}) || $self->throw_exception('Cannot find the relating object.'); my $child = $parent->$rel; @@ -2813,10 +2818,7 @@ sub _resolved_attrs { : ( ( delete $attrs->{columns} ) || - $source->storage->_order_select_columns( - $source, - [ $source->columns ], - ) + $source->columns ) ; @@ -3258,6 +3260,9 @@ When you use function/stored procedure names and do not supply an C attribute, the column names returned are storage-dependent. E.g. MySQL would return a column named C in the above example. +B You will almost always need a corresponding 'as' entry when you use +'select'. + =head2 +select =over 4