[Bast-commits] r5514 - in DBIx-Class/0.08/branches/subquery/t: . resultset search

robkinyon at dev.catalyst.perl.org robkinyon at dev.catalyst.perl.org
Wed Feb 18 02:37:09 GMT 2009


Author: robkinyon
Date: 2009-02-18 02:37:09 +0000 (Wed, 18 Feb 2009)
New Revision: 5514

Added:
   DBIx-Class/0.08/branches/subquery/t/search/
   DBIx-Class/0.08/branches/subquery/t/search/subquery.t
Modified:
   DBIx-Class/0.08/branches/subquery/t/resultset/as_query.t
Log:
Moved the actual subquery test to a new subquery testfile

Modified: DBIx-Class/0.08/branches/subquery/t/resultset/as_query.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/resultset/as_query.t	2009-02-18 02:26:58 UTC (rev 5513)
+++ DBIx-Class/0.08/branches/subquery/t/resultset/as_query.t	2009-02-18 02:37:09 UTC (rev 5514)
@@ -10,7 +10,7 @@
 use DBICTest;
 use DBIC::SqlMakerTest;
 
-plan tests => 5;
+plan tests => 4;
 
 my $schema = DBICTest->init_schema();
 my $art_rs = $schema->resultset('Artist');
@@ -65,19 +65,4 @@
   );
 }
 
-# This is an actual subquery.
-{
-  my $cdrs2 = $cdrs->search({
-    artist_id => { 'in' => $art_rs->search({}, { rows => 1 })->get_column( 'id' )->as_query },
-  });
-
-  my $arr = $cdrs2->as_query;
-  my ($query, @bind) = @{$$arr};
-  is_same_sql_bind(
-    $query, \@bind,
-    "SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE artist_id IN ( SELECT id FROM artist me WHERE ( rank = ? ) AND ( name = ? ) LIMIT 1 )",
-    [ [ rank => 2 ], [ name => 'Billy Joel' ] ],
-  );
-}
-
 __END__

Added: DBIx-Class/0.08/branches/subquery/t/search/subquery.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/search/subquery.t	                        (rev 0)
+++ DBIx-Class/0.08/branches/subquery/t/search/subquery.t	2009-02-18 02:37:09 UTC (rev 5514)
@@ -0,0 +1,33 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings FATAL => 'all';
+
+use Data::Dumper;
+
+use Test::More;
+use lib qw(t/lib);
+use DBICTest;
+use DBIC::SqlMakerTest;
+
+plan tests => 1;
+
+my $schema = DBICTest->init_schema();
+my $art_rs = $schema->resultset('Artist');
+my $cdrs = $schema->resultset('CD');
+
+{
+  my $cdrs2 = $cdrs->search({
+    artist_id => { 'in' => $art_rs->search({}, { rows => 1 })->get_column( 'id' )->as_query },
+  });
+
+  my $arr = $cdrs2->as_query;
+  my ($query, @bind) = @{$$arr};
+  is_same_sql_bind(
+    $query, \@bind,
+    "SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE artist_id IN ( SELECT id FROM artist me LIMIT 1 )",
+    [],
+  );
+}
+
+__END__




More information about the Bast-commits mailing list