Does DBIx :: Class join?

I have not found a way to make unions with DBIx :: Class , other than using manual view and SQL writing. It seems strange to me. I feel that there must be some way to combine the two ResultSets without a lot of extra work, because addition and subtraction are such an essential part of SQL. Is there an easier way to make alliances? If not, why not?

+8
sql perl dbix-class
source share
2 answers

DBIx :: Class :: Helper :: ResultSet :: SetOperations

my $rs1 = $rs->search({ foo => 'bar' }); my $rs2 = $rs->search({ baz => 'biff' }); for ($rs1->union($rs2)->all) { ... } 
+13
source share

As a workaround (without loading more modules) I did something like this:

 $db->resultset("Foo")->search({ -or => [ 'me.id' => { -in => $result_set_a }, 'me.id' => { -in => $result_set_b } ] }, undef); 
0
source share

All Articles