[Bast-commits] r9321 - DBIx-Class/0.08/trunk/lib/DBIx/Class

nigel at dev.catalyst.perl.org nigel at dev.catalyst.perl.org
Fri May 7 13:39:37 GMT 2010


Author: nigel
Date: 2010-05-07 14:39:37 +0100 (Fri, 07 May 2010)
New Revision: 9321

Modified:
   DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
Log:
empty update OK even if row is not in database (fixed)

Modified: DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm
===================================================================
--- DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2010-05-07 13:28:06 UTC (rev 9320)
+++ DBIx-Class/0.08/trunk/lib/DBIx/Class/Row.pm	2010-05-07 13:39:37 UTC (rev 9321)
@@ -519,17 +519,17 @@
 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
   );




More information about the Bast-commits mailing list