[Bast-commits] r6258 - in DBIx-Class/0.08/branches/joined_count/t:
. count
ribasushi at dev.catalyst.perl.org
ribasushi at dev.catalyst.perl.org
Thu May 14 11:19:36 GMT 2009
Author: ribasushi
Date: 2009-05-14 11:19:35 +0000 (Thu, 14 May 2009)
New Revision: 6258
Modified:
DBIx-Class/0.08/branches/joined_count/t/19quotes.t
DBIx-Class/0.08/branches/joined_count/t/19quotes_newstyle.t
DBIx-Class/0.08/branches/joined_count/t/count/count_joined.t
Log:
Straightforward test changes
Modified: DBIx-Class/0.08/branches/joined_count/t/19quotes.t
===================================================================
--- DBIx-Class/0.08/branches/joined_count/t/19quotes.t 2009-05-14 11:18:58 UTC (rev 6257)
+++ DBIx-Class/0.08/branches/joined_count/t/19quotes.t 2009-05-14 11:19:35 UTC (rev 6258)
@@ -35,9 +35,12 @@
{ join => 'artist' });
eval { $rs->count };
is_same_sql_bind(
- $sql, \@bind,
- "SELECT COUNT( * ) FROM `cd` `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
- 'got correct SQL for count query with quoting'
+ $sql,
+ \@bind,
+ "SELECT COUNT( * ) FROM (SELECT `me`.`cdid` FROM `cd` `me` JOIN `artist` `artist` ON `artist`.`artistid` = `me`.`artist` WHERE ( ( `artist`.`name` = ? AND `me`.`year` = ? ) ) GROUP BY `me`.`cdid`) `count_subq`",
+ ["'Caterwauler McCrae'", "'2001'"],
+
+ 'got correct SQL for joined count query with quoting'
);
my $order = 'year DESC';
@@ -59,8 +62,10 @@
{ join => 'artist' });
eval { $rs->count };
is_same_sql_bind(
- $sql, \@bind,
- "SELECT COUNT( * ) FROM [cd] [me] JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
+ $sql,
+ \@bind,
+ "SELECT COUNT( * ) FROM (SELECT [me].[cdid] FROM [cd] [me] JOIN [artist] [artist] ON [artist].[artistid] = [me].[artist] WHERE ( ( [artist].[name] = ? AND [me].[year] = ? ) ) GROUP BY [me].[cdid]) [count_subq]",
+ ["'Caterwauler McCrae'", "'2001'"],
'got correct SQL for count query with bracket quoting'
);
Modified: DBIx-Class/0.08/branches/joined_count/t/19quotes_newstyle.t
===================================================================
--- DBIx-Class/0.08/branches/joined_count/t/19quotes_newstyle.t 2009-05-14 11:18:58 UTC (rev 6257)
+++ DBIx-Class/0.08/branches/joined_count/t/19quotes_newstyle.t 2009-05-14 11:19:35 UTC (rev 6258)
@@ -41,8 +41,10 @@
{ join => 'artist' });
eval { $rs->count };
is_same_sql_bind(
- $sql, \@bind,
- "SELECT COUNT( * ) FROM `cd` `me` JOIN `artist` `artist` ON ( `artist`.`artistid` = `me`.`artist` ) WHERE ( `artist`.`name` = ? AND `me`.`year` = ? )", ["'Caterwauler McCrae'", "'2001'"],
+ $sql,
+ \@bind,
+ "SELECT COUNT( * ) FROM (SELECT `me`.`cdid` FROM `cd` `me` JOIN `artist` `artist` ON `artist`.`artistid` = `me`.`artist` WHERE ( ( `artist`.`name` = ? AND `me`.`year` = ? ) ) GROUP BY `me`.`cdid`) `count_subq`",
+ ["'Caterwauler McCrae'", "'2001'"],
'got correct SQL for count query with quoting'
);
@@ -72,8 +74,10 @@
{ join => 'artist' });
eval { $rs->count };
is_same_sql_bind(
- $sql, \@bind,
- "SELECT COUNT( * ) FROM [cd] [me] JOIN [artist] [artist] ON ( [artist].[artistid] = [me].[artist] ) WHERE ( [artist].[name] = ? AND [me].[year] = ? )", ["'Caterwauler McCrae'", "'2001'"],
+ $sql,
+ \@bind,
+ "SELECT COUNT( * ) FROM (SELECT [me].[cdid] FROM [cd] [me] JOIN [artist] [artist] ON [artist].[artistid] = [me].[artist] WHERE ( ( [artist].[name] = ? AND [me].[year] = ? ) ) GROUP BY [me].[cdid]) [count_subq]",
+ ["'Caterwauler McCrae'", "'2001'"],
'got correct SQL for count query with bracket quoting'
);
Modified: DBIx-Class/0.08/branches/joined_count/t/count/count_joined.t
===================================================================
--- DBIx-Class/0.08/branches/joined_count/t/count/count_joined.t 2009-05-14 11:18:58 UTC (rev 6257)
+++ DBIx-Class/0.08/branches/joined_count/t/count/count_joined.t 2009-05-14 11:19:35 UTC (rev 6258)
@@ -11,8 +11,7 @@
my $schema = DBICTest->init_schema();
-TODO: {
- local $TODO = 'Needs -paren fixes in SQLA before it can work';
+{
my $cds = $schema->resultset("CD")->search({ cdid => 1 }, { join => { cd_to_producer => 'producer' } });
is($cds->count, 1, "extra joins do not explode single entity count");
}
More information about the Bast-commits
mailing list