- COPYRIGHT AND LICENSE
Gideon::Manual::Updating - Updating objects
Gideon can update a single object or a group objects depending on how it is invoked, please make sure you read and understand the documentation as missues of this method can cause data corruption
update( %changes ) as a Class method
update is invoked for a Gideon class it updates all records in a data store with
# Update all objects in the data store People->update( status => 'active' );
update( %changes ) as an Instance method
update is invoked for a Gideon class instance it updates that particular record and not the rest of the records
# Update one object People->find_one( id => 1 )->update( id => 2 );
Updating object with
Additionally you can use the
save method to update a particular object.
my $person = People->find_one( id => 1 ); # Update only the name $person->update( name => 'John Doe' ); # Query: UPDATE ... SET name = 'John Doe' WHERE id = 1 # Update names $person->name('John Doe'); $person->save; # Query: UPDATE ... SET id = 1, name = 'John Doe', ... WHERE id = 1
The difference between
update is that
update gives you a fine grained control on which fields to update.
save sends the entire record as a whole to the data store.
Updating objects with Gideon
Mariano Wahlmann, Gines Razanov
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Mariano Wahlmann, Gines Razanov.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.