- fix _create_ID to return undef when primary keys are not present
sub _create_ID {
my ($class,%vals) = @_;
+ return undef unless 0 == grep { !defined } values %vals;
$class = ref $class || $class;
return join '|', $class, map { $_ . '=' . $vals{$_} } sort keys %vals;
}
sub _construct_object {
my ($self, @row) = @_;
- my @cols = $self->{class}->_select_columns;
+ my @cols = @{ $self->{attrs}{cols} };
+ s/^me\.// for @cols;
+ @cols = grep { ! /\./ } @cols;
my $new;
unless ($self->{attrs}{prefetch}) {
$new = $self->{class}->_row_to_object(\@cols, \@row);
sub run_tests {
-plan tests => 27;
+plan tests => 28;
my @art = DBICTest::Artist->search({ }, { order_by => 'name DESC'});
$cd->discard_changes;
+$cd = DBICTest::CD->search({ title => 'Spoonful of bees' }, { cols => ['title'] })->next;
+is($cd->title, 'Spoonful of bees', 'subset of columns returned correctly');
+
# insert_or_update
$new = DBICTest::Track->new( {
trackid => 100,