[Bio] / Sprout / ERDB.pm Repository:
ViewVC logotype

Diff of /Sprout/ERDB.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.22, Wed Sep 14 09:56:58 2005 UTC revision 1.23, Thu Sep 15 01:46:56 2005 UTC
# Line 553  Line 553 
553  sub CreateTables {  sub CreateTables {
554      # Get the parameters.      # Get the parameters.
555      my ($self) = @_;      my ($self) = @_;
556      my $metadata = $self->{_metaData};      # Get the relation names.
557      my $dbh = $self->{_dbh};      my @relNames = $self->GetTableNames();
558      # Loop through the entities.      # Loop through the relations.
559      my $entityHash = $metadata->{Entities};      for my $relationName (@relNames) {
     for my $entityName (keys %{$entityHash}) {  
         my $entityData = $entityHash->{$entityName};  
         # Tell the user what we're doing.  
         Trace("Creating relations for entity $entityName.") if T(1);  
         # Loop through the entity's relations.  
         for my $relationName (keys %{$entityData->{Relations}}) {  
560              # Create a table for this relation.              # Create a table for this relation.
561              $self->CreateTable($relationName);              $self->CreateTable($relationName);
562              Trace("Relation $relationName created.") if T(1);          Trace("Relation $relationName created.") if T(2);
         }  
     }  
     # Loop through the relationships.  
     my $relationshipTable = $metadata->{Relationships};  
     for my $relationshipName (keys %{$metadata->{Relationships}}) {  
         # Create a table for this relationship.  
         Trace("Creating relationship $relationshipName.") if T(1);  
         $self->CreateTable($relationshipName);  
563      }      }
564  }  }
565    
# Line 724  Line 710 
710      $directoryName =~ s!/\\$!!;      $directoryName =~ s!/\\$!!;
711      # Declare the return variable.      # Declare the return variable.
712      my $retVal = Stats->new();      my $retVal = Stats->new();
713      # Get the metadata structure.      # Get the relation names.
714      my $metaData = $self->{_metaData};      my @relNames = $self->GetTableNames();
715      # Loop through the entities.      for my $relationName (@relNames) {
     for my $entity (values %{$metaData->{Entities}}) {  
         # Loop through the entity's relations.  
         for my $relationName (keys %{$entity->{Relations}}) {  
716              # Try to load this relation.              # Try to load this relation.
717              my $result = $self->_LoadRelation($directoryName, $relationName, $rebuild);              my $result = $self->_LoadRelation($directoryName, $relationName, $rebuild);
718              # Accumulate the statistics.              # Accumulate the statistics.
719              $retVal->Accumulate($result);              $retVal->Accumulate($result);
720          }          }
     }  
     # Loop through the relationships.  
     for my $relationshipName (keys %{$metaData->{Relationships}}) {  
         # Try to load this relationship's relation.  
         my $result = $self->_LoadRelation($directoryName, $relationshipName, $rebuild);  
         # Accumulate the statistics.  
         $retVal->Accumulate($result);  
     }  
721      # Add the duration of the load to the statistical object.      # Add the duration of the load to the statistical object.
722      $retVal->Add('duration', gettimeofday - $startTime);      $retVal->Add('duration', gettimeofday - $startTime);
723      # Return the accumulated statistics.      # Return the accumulated statistics.
724      return $retVal;      return $retVal;
725  }  }
726    
727    
728  =head3 GetTableNames  =head3 GetTableNames
729    
730  C<< my @names = $erdb->GetTableNames; >>  C<< my @names = $erdb->GetTableNames; >>

Legend:
Removed from v.1.22  
changed lines
  Added in v.1.23

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3