Changes
[dbsrgits/DBIx-Class.git] / t / resultset / as_subselect_rs.t
index c143d11..1453f63 100644 (file)
@@ -22,4 +22,21 @@ lives_ok { $new_rs->search({ 'artwork_to_artist.artwork_cd_id' => 1})->as_subsel
    '... and chaining off the virtual view works';
 dies_ok  { $new_rs->as_subselect_rs->search({'artwork_to_artist.artwork_cd_id'=> 1})->count }
    q{... but chaining off of a virtual view using join doesn't work};
+
+my $book_rs = $schema->resultset ('BooksInLibrary')->search ({}, { join => 'owner' });
+
+is_same_sql_bind (
+  $book_rs->as_subselect_rs->as_query,
+  '(SELECT me.id, me.source, me.owner, me.title, me.price 
+      FROM (
+        SELECT me.id, me.source, me.owner, me.title, me.price
+          FROM books me
+          JOIN owners owner ON owner.id = me.owner
+        WHERE ( source = ? )
+      ) me
+  )',
+  [ [ source => 'Library' ] ],
+  'Resultset-class attributes do not seep outside of the subselect',
+);
+
 done_testing;