in reply to dbix::class find() question
poj is right already but I offer the other path–
my $rs = $schema->resultset('records'); my @records = $rs->search({ id => \@ids });
The only caveat I might offer here is that search won’t explicitly complain or fail if say only one of the ids is found. I would also suggest that you do this kind of thing instead–
my $rs = $schema->resultset('records') ->search({ id => \@ids }); for my $row ( $rs->all ) {}
As long as you remain in the realm of pure resultsets you don’t execute SQL. So working with them that way—RS until you are ready for records—is more flexible, extensible, and often more performant—as the biz-devs say—since you can end up hitting the DB less.
Update! Didn’t use hasref args initially.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: dbix::class find() question
by tqisjim (Beadle) on Jan 18, 2016 at 19:58 UTC | |
by Mr. Muskrat (Canon) on Jan 18, 2016 at 20:42 UTC | |
by Your Mother (Archbishop) on Jan 18, 2016 at 21:41 UTC | |
by Your Mother (Archbishop) on Jan 18, 2016 at 20:29 UTC |