Hi David,
You need to call either update or update_all on the ResultSet. See docs:
http://search.cpan.org/~ribasushi/DBIx-Class-0.08120/lib/DBIx/Class/ResultSet.pm#update
http://search.cpan.org/~ribasushi/DBIx-Class-0.08120/lib/DBIx/Class/ResultSet.pm#update_all
Try something like this:
$c->model('DB::Test')->search({id => $c->user->get('id'))->update({lang =>
$lang->first->id});
Ben
On Tue, 23 Mar 2010 18:15:55 +0000 (GMT), David <[email protected]>
wrote:
> Hi,
>
> I can't find how to set 'where' clause in an update. I only want to
update
> rows depending on a condition. Is that possible?
> I haven't this option in ResultSet documentation.
>
> I try like next, but it doesn't work. It updates all table rows.
>
> $c->model('DB::Test')->update({'lang' => $lang->first->id},{where =>
{'id'
> => $c->user->get('id')}});
>
>
>
> Thanks in advanced,
>
> David
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/