}
method _remove_from_store ($old) {
- $self->_store->new_delete_command($self->_deflate($old))->execute;
+ $self->_store->new_delete_command($self->_deflate($old))->execute
}
method _remove_from_caches ($old) {
$old
}
+## update
+
+method _update_in_store ($obj) {
+ # this is currently a call command but we should think about it
+ # being a row command so that we can have RETURNING or other
+ # mechanisms handle things like set-on-update datetime values
+ $self->_store->new_update_command($self->_deflate($obj))->execute
+}
+
1;
is_deeply([ sort_set $set->flatten ], \@expect, 'new row still gone on reload');
+$set = make_set {}, {
+ update_sql => q{UPDATE person SET name = ? WHERE id = ?},
+ update_argument_order => [ qw(name id) ]
+};
+
+my ($pterry) = grep $_->{name} eq 'Pterry', $set->flatten;
+
+$pterry->{name} = 'Sir Pterry'; # http://xrl.us/bgse8s
+
+$set->_update_in_store($pterry);
+
+$set = make_set;
+
+my ($fresh_pterry) = grep $_->{name} =~ /Pterry/, $set->flatten;
+
+is($fresh_pterry->{name}, 'Sir Pterry', 'Update persisted correctly');
+
done_testing;