Revision history for DBIx::Class
+ - Fix +select, +as, +columns and include_columns being stripped from
+ ->get_columns (gphat)
+
0.081000 2009-04-19 11:39:35 (UTC)
- Todo out the register_extra_source test until after shipping
$class = ref $class if ref $class;
my $new_parent_rs = $rs->search_rs; # we don't want to mess up the original, so clone it
my $attrs = $new_parent_rs->_resolved_attrs;
- $new_parent_rs->{attrs}->{$_} = undef for qw(prefetch include_columns +select +as); # prefetch, include_columns, +select, +as cause additional columns to be fetched
+ $new_parent_rs->{attrs}->{prefetch} = undef; # prefetch cause additional columns to be fetched
# If $column can be found in the 'as' list of the parent resultset, use the
# corresponding element of its 'select' list (to keep any custom column
my $schema = DBICTest->init_schema();
-plan tests => 12;
+plan tests => 13;
my $rs = $schema->resultset('CD')->search({},
{
lives_ok(sub { $rs->first->get_column('count') }, 'multiple +select/+as columns, 1st rscolumn present');
lives_ok(sub { $rs->first->get_column('addedtitle') }, 'multiple +select/+as columns, 2nd rscolumn present');
+# Tests a regression in ResultSetColumn wrt +select
+my $rs = $schema->resultset('CD')->search(undef,
+ {
+ '+select' => [ \'COUNT(*) AS year_count' ],
+ order_by => 'year_count'
+ }
+);
+my @counts = $rs->get_column('cdid')->all;
+ok(scalar(@counts), 'got rows from ->all using +select');
+
$rs = $schema->resultset('CD')->search({},
{
'+select' => [ \ 'COUNT(*)', 'title' ],