[Bast-commits] r5966 - in DBIx-Class/0.08/trunk: . lib/DBIx/Class t
gphat at dev.catalyst.perl.org
gphat at dev.catalyst.perl.org
Thu Apr 23 20:49:05 GMT 2009
Author: gphat
Date: 2009-04-23 21:49:04 +0100 (Thu, 23 Apr 2009)
New Revision: 5966
Modified:
DBIx-Class/0.08/trunk/Changes
DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSetColumn.pm
DBIx-Class/0.08/trunk/t/76select.t
Log:
Fix busted get_column when using +select (and friends)
Modified: DBIx-Class/0.08/trunk/Changes
===================================================================
--- DBIx-Class/0.08/trunk/Changes 2009-04-23 15:39:22 UTC (rev 5965)
+++ DBIx-Class/0.08/trunk/Changes 2009-04-23 20:49:04 UTC (rev 5966)
@@ -1,5 +1,8 @@
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
Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSetColumn.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSetColumn.pm 2009-04-23 15:39:22 UTC (rev 5965)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSetColumn.pm 2009-04-23 20:49:04 UTC (rev 5966)
@@ -38,7 +38,7 @@
$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
Modified: DBIx-Class/0.08/trunk/t/76select.t
===================================================================
--- DBIx-Class/0.08/trunk/t/76select.t 2009-04-23 15:39:22 UTC (rev 5965)
+++ DBIx-Class/0.08/trunk/t/76select.t 2009-04-23 20:49:04 UTC (rev 5966)
@@ -8,7 +8,7 @@
my $schema = DBICTest->init_schema();
-plan tests => 12;
+plan tests => 13;
my $rs = $schema->resultset('CD')->search({},
{
@@ -28,6 +28,16 @@
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' ],
More information about the Bast-commits
mailing list