[Bast-commits] r5528 - DBIx-Class/0.08/branches/subquery/t/search

michaelr at dev.catalyst.perl.org michaelr at dev.catalyst.perl.org
Thu Feb 19 02:24:44 GMT 2009


Author: michaelr
Date: 2009-02-19 02:24:44 +0000 (Thu, 19 Feb 2009)
New Revision: 5528

Modified:
   DBIx-Class/0.08/branches/subquery/t/search/subquery.t
Log:
added another TODO test for a nested from =>



Modified: DBIx-Class/0.08/branches/subquery/t/search/subquery.t
===================================================================
--- DBIx-Class/0.08/branches/subquery/t/search/subquery.t	2009-02-18 22:59:29 UTC (rev 5527)
+++ DBIx-Class/0.08/branches/subquery/t/search/subquery.t	2009-02-19 02:24:44 UTC (rev 5528)
@@ -10,7 +10,7 @@
 use DBICTest;
 use DBIC::SqlMakerTest;
 
-plan tests => 4;
+plan tests => 5;
 
 my $schema = DBICTest->init_schema();
 my $art_rs = $schema->resultset('Artist');
@@ -74,6 +74,26 @@
   );
 }
 
+# nested from
+TODO: {
+  local $TODO = "'from' doesn't work with as_query yet.";
+  my $art_rs2 = $schema->resultset('Artist')->search({}, 
+  {
+    from => [ { 'me' => 'artist' }, 
+      [ { 'cds' => $cdrs->search({},{ 'select' => [\'me.artist as cds_artist' ]})->as_query },
+      { 'me.artistid' => 'cds_artist' } ] ]
+  });
+
+  my $arr = $art_rs2->as_query;
+  my ($query, @bind) = @{$$arr};
+  is_same_sql_bind(
+    $query, \@bind,
+    "SELECT me.artistid, me.name, me.rank, me.charfield FROM artist me JOIN (SELECT me.artist as cds_artist FROM cd me) cds ON me.artistid = cds_artist", []
+  );
+
+
+}
+
 {
   my $rs = $cdrs->search({
     year => {




More information about the Bast-commits mailing list