From: Arthur Axel 'fREW' Schmidt Date: Wed, 16 Mar 2011 01:56:43 +0000 (-0500) Subject: test for related_resultset + alias X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d5d1783f059f0638f3ae4610eac569cbc03d7a58;p=dbsrgits%2FDBIx-Class.git test for related_resultset + alias --- diff --git a/t/prefetch/correlated.t b/t/prefetch/correlated.t index 7e7690d..ebcccc4 100644 --- a/t/prefetch/correlated.t +++ b/t/prefetch/correlated.t @@ -12,6 +12,15 @@ my $orig_debug = $schema->storage->debug; my $cdrs = $schema->resultset('CD')->search({ 'me.artist' => { '!=', 2 }}); +is_same_sql_bind( + $cdrs + ->related_resultset('artwork') + ->search(undef, { alias => 'frewmbot' }) + ->as_query, + + '(SELECT frewmbot.cd_id FROM cd me JOIN cd_artwork frewmbot ON artwork.cd_id = me.cdid WHERE ( me.artist != ? ))', + [ [ 'me.artist' => 2 ] ] +); my $cd_data = { map { $_->cdid => { siblings => $cdrs->search ({ artist => $_->get_column('artist') })->count - 1,