From: Michael Reddick Date: Thu, 19 Feb 2009 02:24:44 +0000 (+0000) Subject: added another TODO test for a nested from => X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=a3c8d69536a8e67c18e091bf74021f58a695f681;p=dbsrgits%2FDBIx-Class-Historic.git added another TODO test for a nested from => --- diff --git a/t/search/subquery.t b/t/search/subquery.t index 47e0746..1a6861a 100644 --- a/t/search/subquery.t +++ b/t/search/subquery.t @@ -10,7 +10,7 @@ use lib qw(t/lib); 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 @@ TODO: { ); } +# 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 => {