On Tue, Jul 14, 2009 at 09:52:12AM +0200, Yves Räber wrote:
> Hello,
> 
> I need to update the first X rows of a resultset, and I've tried something 
> like this :
> 
> my $to_dispatch = $c->model('myDB::Table')->search($sql_args, { rows => 10 });
> $to_dispatch->update( { state => 'TODO' } );
> 
> It works, but generate a query for each row.
> 
> What I would like to generate is a query that looks like "UPDATE Table SET 
> state = 'TODO' WHERE blablabla LIMIT 10".
> 
> It it possible to do this with DBIx::Class ?

Anything is possible with DBIC, but the real question is - is it possible
with your RDBMS. What I ned to know is:

* Your rdbms type
* What kind of PK is on myDB::Table (single column or multicolumn)
* Are you absolutely sure UPDATE ... LIMIT X actually works, instead of
  LIMIT being simply ignored? Please test with manual queries.

_______________________________________________
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/[email protected]

Reply via email to