From: Matt S Trout Date: Tue, 12 Jan 2010 10:40:14 +0000 (+0000) Subject: rename update/delete to update_single/delete_single X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=dbsrgits%2FDBIx-Data-Store-old.git;a=commitdiff_plain;h=a1e15ee146637d3eab4a103117464f23b2f94051 rename update/delete to update_single/delete_single --- diff --git a/lib/DBIx/Data/Collection/Set.pm b/lib/DBIx/Data/Collection/Set.pm index 2672dd4..29b116d 100644 --- a/lib/DBIx/Data/Collection/Set.pm +++ b/lib/DBIx/Data/Collection/Set.pm @@ -250,7 +250,7 @@ method remove ($old) { } method _remove_from_store ($old) { - $self->_store->new_delete_command($self->_deflate($old))->execute + $self->_store->new_delete_single_command($self->_deflate($old))->execute } method _remove_from_caches ($old) { @@ -265,7 +265,7 @@ 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 + $self->_store->new_update_single_command($self->_deflate($obj))->execute } 1; diff --git a/lib/DBIx/Data/Store/CRUD.pm b/lib/DBIx/Data/Store/CRUD.pm index 88bd4ff..c81dd0b 100644 --- a/lib/DBIx/Data/Store/CRUD.pm +++ b/lib/DBIx/Data/Store/CRUD.pm @@ -5,7 +5,7 @@ use Method::Signatures::Simple; has raw_store => (is => 'ro', required => 1); # DBIx::Data::Store object -foreach my $type (qw(select select_single insert update delete)) { +foreach my $type (qw(select select_single insert update update_single delete delete_single)) { has "${type}_sql" => (is => 'ro', predicate => "has_${type}_sql"); has "${type}_argument_order" => (is => 'ro', default => sub { [] }); } @@ -67,6 +67,14 @@ method new_delete_command ($args) { $self->_new_call_command(delete => $args); } +method new_update_single_command ($args) { + $self->_new_call_command(update_single => $args); +} + +method new_delete_single_command ($args) { + $self->_new_call_command(delete_single => $args); +} + __PACKAGE__->meta->make_immutable; 1; diff --git a/t/01basic_collection.t b/t/01basic_collection.t index e9fb8e1..8ad5fc7 100644 --- a/t/01basic_collection.t +++ b/t/01basic_collection.t @@ -90,8 +90,8 @@ sub run_tests { insert_call_command => $self->raw_store->new_call_command(@_) ); }, - delete_sql => q{DELETE FROM person WHERE id = ?}, - delete_argument_order => [ 'id' ], + delete_single_sql => q{DELETE FROM person WHERE id = ?}, + delete_single_argument_order => [ 'id' ], }; my $doug = $set->add({ name => 'Doug' }); @@ -113,8 +113,8 @@ sub run_tests { 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) ] + update_single_sql => q{UPDATE person SET name = ? WHERE id = ?}, + update_single_argument_order => [ qw(name id) ] }; my ($pterry) = grep $_->{name} eq 'Pterry', $set->flatten;