Vladimir Melnik <v.mel...@uplink.ua> writes: > Hello, > > Is that possible to merge multiple ResultSets into one? For example, > I’ve got 3 different ResultSets (as the yields of 3 different > SQL-queries), but I’m pretty sure that they are based on the same > class. Yes, I can work with their Results as with elements of a list, > but sometimes it would be much more complicated to work with them as > with a single ResultSet. Is that possible?
What you are looking for is the 'union_all' method from https://metacpan.org/pod/DBIx::Class::Helper::ResultSet::SetOperations > ...and here’s what I’d like to do: > my $rs1 = $schema->resultset('Foo')->search({ bar => 1 }); > my $rs2 = $schema->resultset('Foo')->search({ bar => 2 }); > my $rs3 = $schema->resultset('Foo')->search({ bar => 3 }); > my $rs_merged = ...; # <-- Something cool happens here my $rs_merged = $rs1->union_all([$rs2, $rs3]); > foreach ($rs_merged->all) { > $r->do_something; > } […] > Thanks in advance for any hints and clues! Hope this helps! - ilmari -- "The surreality of the universe tends towards a maximum" -- Skud's Law "Never formulate a law or axiom that you're not prepared to live with the consequences of." -- Skud's Meta-Law _______________________________________________ List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class IRC: irc.perl.org#dbix-class SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/ Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk