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

Diff of /Sprout/ERDBLoad.pm

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

revision 1.14, Wed Jun 21 03:12:51 2006 UTC revision 1.19, Fri Nov 3 00:34:10 2006 UTC
# Line 82  Line 82 
82          Trace("Relation $relationName will be loaded from $fileName.") if T(2);          Trace("Relation $relationName will be loaded from $fileName.") if T(2);
83          $fileHandle = "";          $fileHandle = "";
84      } else {      } else {
85          # If this is a primary entity relation whose key is not a hash string, sort          # Determine the sort for this relation.
86          # the output to remove duplicate keys.          my $fileString = "| " . $erdb->SortNeeded($relationName) . " >$fileName";
87          my $fileString = ($erdb->SortNeeded($relationName) ?          Trace("Load file creation string is \"$fileString\".") if T(3);
                             "| sort +0 -1 -u -t \"\t\" >$fileName" :  
                             ">$fileName");  
88          # Open the output file and remember its handle.          # Open the output file and remember its handle.
89          $fileHandle = Open(undef, $fileString);          $fileHandle = Open(undef, $fileString);
90          Trace("Relation $relationName load file created with primary flag $primary.") if T(2);          Trace("Relation $relationName load file created with primary flag $primary.") if T(2);
# Line 233  Line 231 
231      return $self->{stats};      return $self->{stats};
232  }  }
233    
234    =head3 FinishAndLoad
235    
236    C<< my $stats = $erload->FinishAndLoad(); >>
237    
238    Finish the load and load the table, returning the statistics.
239    
240    =cut
241    
242    sub FinishAndLoad {
243        # Get the parameters.
244        my ($self) = @_;
245        # Finish the load file.
246        my $retVal = $self->Finish();
247        # Load the table.
248        my $newStats = $self->LoadTable();
249        # Accumulate the stats.
250        $retVal->Accumulate($newStats);
251        # Return the result.
252        return $retVal;
253    }
254    
255  =head3 RelName  =head3 RelName
256    
257  C<< my $name = $erload->RelName; >>  C<< my $name = $erload->RelName; >>
# Line 248  Line 267 
267      return $self->{relName};      return $self->{relName};
268  }  }
269    
270    =head3 LoadTable
271    
272    C<< my $stats = $erload->LoadTable(); >>
273    
274    Load the database table from the load file and return a statistics object.
275    
276    =cut
277    
278    sub LoadTable {
279        # Get the parameters.
280        my ($self) = @_;
281        # Get the database object, the file name, and the relation name.
282        my $erdb = $self->{dbh};
283        my $fileName = $self->{fileName};
284        my $relName = $self->{relName};
285        # Load the table. The third parameter indicates this is a drop and reload.
286        my $retVal = $erdb->LoadTable($fileName, $relName, 1);
287        # Return the result.
288        return $retVal;
289    }
290    
291  1;  1;
292    

Legend:
Removed from v.1.14  
changed lines
  Added in v.1.19

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3