[Bast-commits] r8576 - DBIx-Class/0.08/trunk/lib/DBIx/Class

frew at dev.catalyst.perl.org frew at dev.catalyst.perl.org
Mon Feb 8 05:17:43 GMT 2010


Author: frew
Date: 2010-02-08 05:17:43 +0000 (Mon, 08 Feb 2010)
New Revision: 8576

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
Log:
another example of as_subselect_rs

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm	2010-02-07 20:13:04 UTC (rev 8575)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/ResultSet.pm	2010-02-08 05:17:43 UTC (rev 8576)
@@ -2623,6 +2623,18 @@
  # works as expected: finds a 'table' row related to two x rows (abc and def)
  my $correctly_joined_rs = $rs2->search({'x.name' => 'def'});
 
+Another example of when one might use this would be to select a subset of
+columns in a group by clause:
+
+ my $rs = $schema->resultset('Bar')->search(undef, {
+   group_by => [qw{ id foo_id baz_id }],
+ })->as_subselect_rs->search(undef, {
+   columns => [qw{ id foo_id }]
+ });
+
+In the above example normally columns would have to be equal to the group by,
+but because we isolated the group by into a subselect the above works.
+
 =cut
 
 sub as_subselect_rs {




More information about the Bast-commits mailing list