From: Michael Reddick Date: Thu, 12 Mar 2009 18:17:03 +0000 (+0000) Subject: added failing from => rs->as_query test X-Git-Tag: v0.08103~101^2~13^2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8996a659891c455154e3c31ec82cdc50583c10ec;p=dbsrgits%2FDBIx-Class.git added failing from => rs->as_query test --- diff --git a/t/search/subquery.t b/t/search/subquery.t index 2abf1a3..b5e0548 100644 --- a/t/search/subquery.t +++ b/t/search/subquery.t @@ -11,7 +11,7 @@ BEGIN { eval "use SQL::Abstract 1.49"; plan $@ ? ( skip_all => "Needs SQLA 1.49+" ) - : ( tests => 7 ); + : ( tests => 8 ); } use lib qw(t/lib); @@ -167,4 +167,24 @@ my $cdrs = $schema->resultset('CD'); ); } +{ + my $rs = $cdrs->search( + {}, + { + alias => 'cd2', + from => [ + { cd2 => $cdrs->search({ title => 'Thriller' })->as_query }, + ], + }, + ); + + my $arr = $rs->as_query; + my ($query, @bind) = @{$$arr}; + is_same_sql_bind( + $query, \@bind, + "SELECT cd2.cdid, cd2.artist, cd2.title, cd2.year, cd2.genreid, cd2.single_track FROM (SELECT me.cdid,me.artist,me.title,me.year,me.genreid,me.single_track FROM cd me WHERE title = 'Thriller') cd2", + [], + ); +} + __END__