From: Nigel Metheringham Date: Fri, 7 May 2010 13:39:37 +0000 (+0000) Subject: empty update OK even if row is not in database (fixed) X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ad3f2296a99dac262f948f07f36a635d69995c8b;p=dbsrgits%2FDBIx-Class-Historic.git empty update OK even if row is not in database (fixed) --- diff --git a/lib/DBIx/Class/Row.pm b/lib/DBIx/Class/Row.pm index ecbff0c..02e51d3 100644 --- a/lib/DBIx/Class/Row.pm +++ b/lib/DBIx/Class/Row.pm @@ -519,17 +519,17 @@ this method. sub update { my ($self, $upd) = @_; - my $ident_cond = $self->{_orig_ident} || $self->ident_condition; - - $self->throw_exception('Unable to update a row with incomplete or no identity') - if ! keys %$ident_cond; - $self->set_inflated_columns($upd) if $upd; my %to_update = $self->get_dirty_columns; return $self unless keys %to_update; $self->throw_exception( "Not in database" ) unless $self->in_storage; + my $ident_cond = $self->{_orig_ident} || $self->ident_condition; + + $self->throw_exception('Unable to update a row with incomplete or no identity') + if ! keys %$ident_cond; + my $rows = $self->result_source->storage->update( $self->result_source, \%to_update, $ident_cond );