Matt will your way though not have multiple trips to the db?

On Wed, Apr 19, 2017 at 3:17 AM, Matt S Trout <m...@shadowcat.co.uk> wrote:

> On Tue, Apr 18, 2017 at 05:20:55PM +0300, Vladimir Melnik wrote:
> > On Tue, Apr 18, 2017 at 02:43:55PM +0100, Dagfinn Ilmari Mannsåker wrote:
> > > What you are looking for is the 'union_all' method from
> > > https://metacpan.org/pod/DBIx::Class::Helper::ResultSet::SetOperations
> >
> > Thank you very much, it's exactly what I've been looking for!
>
> Note that if you don't need an actual UNION query you can also do -
>
>   my $merged = $schema->resultset('Foo');
>   $merged->set_cache([ map $_->all, $rs1, $rs2, $rs3 ]);
>
> and then iterating $merged will just use the cache.
>
> This may or may not be better, depending on your goal.
>
> --
> Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a
> clue
>
> http://shadowcat.co.uk/blog/matt-s-trout/   http://twitter.com/shadowcat_
> mst/
>
> Email me now on mst (at) shadowcat.co.uk and let's chat about how our CPAN
> commercial support, training and consultancy packages could help your team.
>
> _______________________________________________
> 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
>
_______________________________________________
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

Reply via email to