Matt Lawrence wrote:
Angel Kolev wrote:
Hi, all.
I have a table with fields 'id' and 'status'. Status is ENUM field
with values 'active' and 'backup'. I need somethink like(i use dbic
in catalyst):
my $rs = $c->model('ModelDB::CheckMap')->search({id =>
$id})->update('status','backup');
$rs->create({%params});
I have to change the status of all old fields for id $id to 'backup'
then create new fields. Can i change this status in one pass like
example above?
As far as I can see, the only problem with the line you have is that
update expects a hashref.
Matt
Oops, also, update won't return the ResultSet, so $rs won't be what you
expect on the second line.
my $rs = $c->model('ModelDB::CheckMap');
$rs->search({ id => $id })->update({ status => 'backup' });
$rs->create(\%params);
Matt
_______________________________________________
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]