[Dbix-class] updating multiple records at once

Aaron Trevena aaron.trevena at gmail.com
Sat Jan 26 19:18:27 GMT 2008


On 25/01/2008, Jonathan Rockway <jon at jrock.us> wrote:
> > I've had a quick google and scan of the docs but can't find anything
> > about updating multiple records at once.
>
> How about:
>
>    $schema->resultset('SomeTable')->search({ records => 'to update' })
>        ->update({ foo => 'bar' });
>
> That's the idea behind the ResultSet; you get one and you do stuff to it

Ok - that's pretty cool - now for a hundred bonus points * and a pony * :

Can you do that with subsets of a result set - i.e. I have a resultset
of a page of records, 20 need to have the "fantastic" flag set, 100
need to have the state set from "pending" to approved.

If this is the case then I'll be a very happy bunny.

A.

-- 
http://www.aarontrevena.co.uk
LAMP System Integration, Development and Hosting



More information about the DBIx-Class mailing list