[Bps-public-commit] r17223 - Prophet/branches/sqlite/lib/Prophet/Replica

sunnavy at bestpractical.com sunnavy at bestpractical.com
Sun Dec 14 22:09:44 EST 2008


Author: sunnavy
Date: Sun Dec 14 22:09:43 2008
New Revision: 17223

Modified:
   Prophet/branches/sqlite/lib/Prophet/Replica/sqlite.pm

Log:
proceed _load_changeset_from_db

Modified: Prophet/branches/sqlite/lib/Prophet/Replica/sqlite.pm
==============================================================================
--- Prophet/branches/sqlite/lib/Prophet/Replica/sqlite.pm	(original)
+++ Prophet/branches/sqlite/lib/Prophet/Replica/sqlite.pm	Sun Dec 14 22:09:43 2008
@@ -441,12 +441,18 @@
     $sth->execute($changeset->sequence_no);
     while (my $row = $sth->fetchrow_hashref) {
         my $change_id = delete $row->{id};
-        my $change = Prophet::Change->new( record_uuid => $row->{record}, change_type => $row->{change_type}, record_type => "XXX TODO?!");
+        my $record_sth = $self->dbh->prepare("SELECT type FROM records WHERE uuid = ?");
+        $record_sth->execute( $row->{record} );
+        my $type = $record_sth->fetchrow_array();
+
+        my $change = Prophet::Change->new( record_uuid => $row->{record},
+                change_type => $row->{change_type}, record_type => $type );
         my $propchange_sth = $self->dbh->prepare("SELECT name, old_value, new_value FROM prop_changes WHERE change = ?");
         $propchange_sth->execute($change_id);
         while (my $pc = $propchange_sth->fetchrow_hashref) {
             $change->add_prop_change( name => $pc->{name}, old => $pc->{old_value}, new => $pc->{new_value});
         }
+        push @{$changeset->changes}, $change;
     }
 
     return $changeset;



More information about the Bps-public-commit mailing list