[Bast-commits] r4426 - in
DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class: .
Storage Storage/DBI
jnapiorkowski at dev.catalyst.perl.org
jnapiorkowski at dev.catalyst.perl.org
Fri May 30 00:03:16 BST 2008
Author: jnapiorkowski
Date: 2008-05-30 00:03:15 +0100 (Fri, 30 May 2008)
New Revision: 4426
Modified:
DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/PK.pm
DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage.pm
DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI.pm
DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI/Replicated.pm
Log:
changed Storage->reload_row to do less, reverted some behavior to PK->discard_changes. Did this to solve some capatibility issues with partitioning. updated docs to reflect this.
Modified: DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/PK.pm
===================================================================
--- DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/PK.pm 2008-05-29 18:30:39 UTC (rev 4425)
+++ DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/PK.pm 2008-05-29 23:03:15 UTC (rev 4426)
@@ -37,8 +37,22 @@
sub discard_changes {
my ($self) = @_;
- my $storage = $self->result_source->schema->storage;
- $storage->reload_row($self);
+ delete $self->{_dirty_columns};
+ return unless $self->in_storage; # Don't reload if we aren't real!
+
+ my $reload = $self->result_source->schema->storage->reload_row($self);
+
+ unless ($reload) { # If we got deleted in the mean-time
+ $self->in_storage(0);
+ return $self;
+ }
+
+ %$self = %$reload;
+
+ # Avoid a possible infinite loop with
+ # sub DESTROY { $_[0]->discard_changes }
+ bless $reload, 'Do::Not::Exist';
+
return $self;
}
Modified: DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI/Replicated.pm
===================================================================
--- DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI/Replicated.pm 2008-05-29 18:30:39 UTC (rev 4425)
+++ DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI/Replicated.pm 2008-05-29 23:03:15 UTC (rev 4426)
@@ -492,8 +492,8 @@
around 'reload_row' => sub {
my ($reload_row, $self, $row) = @_;
- $self->execute_reliably(sub {
- $self->$reload_row(shift);
+ return $self->execute_reliably(sub {
+ return $self->$reload_row(shift);
}, $row);
};
Modified: DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI.pm
===================================================================
--- DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI.pm 2008-05-29 18:30:39 UTC (rev 4425)
+++ DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage/DBI.pm 2008-05-29 23:03:15 UTC (rev 4426)
@@ -1296,26 +1296,14 @@
return @row;
}
-sub reload_row {
- my ($self, $row) = @_;
- delete $row->{_dirty_columns};
- return unless $row->in_storage; # Don't reload if we aren't real!
-
- my $reload = $row->result_source->resultset->find(
- map { $row->$_ } $row->primary_columns
- );
- unless ($reload) { # If we got deleted in the mean-time
- $row->in_storage(0);
- return $row;
- }
-
- $row = %$reload;
-
- # Avoid a possible infinite loop with
- # sub DESTROY { $_[0]->discard_changes }
- bless $reload, 'Do::Not::Exist';
-
- return $row;
+sub reload_row {
+ my ($self, $row) = @_;
+
+ my $reload = $row->result_source->resultset->find(
+ map { $row->$_ } $row->primary_columns
+ );
+
+ return $reload;
}
=head2 sth
Modified: DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage.pm
===================================================================
--- DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage.pm 2008-05-29 18:30:39 UTC (rev 4425)
+++ DBIx-Class/0.08/branches/replication_dedux/lib/DBIx/Class/Storage.pm 2008-05-29 23:03:15 UTC (rev 4426)
@@ -440,8 +440,8 @@
=head2 reload_row ($row)
-given a L<DBIx::Class::Row> object, 'reloads' it from the storage. This will
-destroy any existing changes you have not yet saved.
+given a L<DBIx::Class::Row> object, loads and returns the matching version from
+storage. Does not effect the existing row object.
=cut
More information about the Bast-commits
mailing list