To do an insert with Class :: DBI, you can simply do:
my $object = Object::DB->insert({ a => 1, b => 2, c => 3, ...});
But there is no such thing for an update. The best I could come up with is to select the record first and then update it:
my $object = Object::DB->retrieve($id); my $object->set( a => 1, b => 2, c => 3, ...}; $object->update;
This is not effective since I have to do SELECT first and then UPDATE instead of a single UPDATE.
Is there a better way to do this with Class :: DBI? I do not want to do 42 $ object-> a (1), $ object-> b (2), etc., $ Object-> update;
perl
Julien
source share