[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.3, Wed Jan 26 22:26:09 2005 UTC revision 1.4, Fri Feb 25 18:41:45 2005 UTC
# Line 163  Line 163 
163    
164  sub ShowMetaData {  sub ShowMetaData {
165          # Get the parameters.          # Get the parameters.
166          my $self = shift @_;          my ($self, $filename) = @_;
         my ($filename) = @_;  
167          # Get the metadata and the title string.          # Get the metadata and the title string.
168          my $metadata = $self->{_metaData};          my $metadata = $self->{_metaData};
169          # Get the title string.          # Get the title string.
# Line 302  Line 301 
301    
302  sub DumpMetaData {  sub DumpMetaData {
303          # Get the parameters.          # Get the parameters.
304          my $self = shift @_;          my ($self) = @_;
305          # Dump the meta-data.          # Dump the meta-data.
306          return Data::Dumper::Dumper($self->{_metaData});          return Data::Dumper::Dumper($self->{_metaData});
307  }  }
# Line 320  Line 319 
319    
320  sub CreateTables {  sub CreateTables {
321          # Get the parameters.          # Get the parameters.
322          my $self = shift @_;          my ($self) = @_;
323          my $metadata = $self->{_metaData};          my $metadata = $self->{_metaData};
324          my $dbh = $self->{_dbh};          my $dbh = $self->{_dbh};
325          # Loop through the entities.          # Loop through the entities.
# Line 366  Line 365 
365    
366  sub CreateTable {  sub CreateTable {
367          # Get the parameters.          # Get the parameters.
368          my $self = shift @_;          my ($self, $relationName, $indexFlag) = @_;
         my ($relationName, $indexFlag) = @_;  
369          # Get the database handle.          # Get the database handle.
370          my $dbh = $self->{_dbh};          my $dbh = $self->{_dbh};
371          # Get the relation data and determine whether or not the relation is primary.          # Get the relation data and determine whether or not the relation is primary.
# Line 414  Line 412 
412    
413  sub CreateIndex {  sub CreateIndex {
414          # Get the parameters.          # Get the parameters.
415          my $self = shift @_;          my ($self, $relationName) = @_;
         my ($relationName) = @_;  
416          # Get the relation's descriptor.          # Get the relation's descriptor.
417          my $relationData = $self->_FindRelation($relationName);          my $relationData = $self->_FindRelation($relationName);
418          # Get the database handle.          # Get the database handle.
# Line 471  Line 468 
468    
469  sub LoadTables {  sub LoadTables {
470          # Get the parameters.          # Get the parameters.
471          my $self = shift @_;          my ($self, $directoryName, $rebuild) = @_;
         my ($directoryName, $rebuild) = @_;  
472          # Start the timer.          # Start the timer.
473          my $startTime = gettimeofday;          my $startTime = gettimeofday;
474          # Clean any trailing slash from the directory name.          # Clean any trailing slash from the directory name.
# Line 514  Line 510 
510    
511  sub GetTableNames {  sub GetTableNames {
512          # Get the parameters.          # Get the parameters.
513          my $self = shift @_;          my ($self) = @_;
514          # Get the relation list from the metadata.          # Get the relation list from the metadata.
515          my $relationTable = $self->{_metaData}->{RelationTable};          my $relationTable = $self->{_metaData}->{RelationTable};
516          # Return the relation names.          # Return the relation names.
# Line 531  Line 527 
527    
528  sub GetEntityTypes {  sub GetEntityTypes {
529          # Get the database object.          # Get the database object.
530          my $self = shift @_;          my ($self) = @_;
531          # Get the entity list from the metadata object.          # Get the entity list from the metadata object.
532          my $entityList = $self->{_metaData}->{Entities};          my $entityList = $self->{_metaData}->{Entities};
533          # Return the list of entity names in alphabetical order.          # Return the list of entity names in alphabetical order.
# Line 616  Line 612 
612    
613  sub Get {  sub Get {
614          # Get the parameters.          # Get the parameters.
615          my $self = shift @_;          my ($self, $objectNames, $filterClause, @params) = @_;
         my ($objectNames, $filterClause, @params) = @_;  
616          # Construct the SELECT statement. The general pattern is          # Construct the SELECT statement. The general pattern is
617          #          #
618          # SELECT name1.*, name2.*, ... nameN.* FROM name1, name2, ... nameN          # SELECT name1.*, name2.*, ... nameN.* FROM name1, name2, ... nameN
# Line 761  Line 756 
756    
757  sub ComputeObjectSentence {  sub ComputeObjectSentence {
758          # Get the parameters.          # Get the parameters.
759          my $self = shift @_;          my ($self, $objectName) = @_;
         my ($objectName) = @_;  
760          # Set the default return value.          # Set the default return value.
761          my $retVal = $objectName;          my $retVal = $objectName;
762          # Look for the object as a relationship.          # Look for the object as a relationship.
# Line 794  Line 788 
788    
789  sub DumpRelations {  sub DumpRelations {
790          # Get the parameters.          # Get the parameters.
791          my $self = shift @_;          my ($self, $outputDirectory) = @_;
         my ($outputDirectory) = @_;  
792          # Now we need to run through all the relations. First, we loop through the entities.          # Now we need to run through all the relations. First, we loop through the entities.
793          my $metaData = $self->{_metaData};          my $metaData = $self->{_metaData};
794          my $entities = $metaData->{Entities};          my $entities = $metaData->{Entities};
# Line 853  Line 846 
846    
847  sub InsertObject {  sub InsertObject {
848          # Get the parameters.          # Get the parameters.
849          my $self = shift @_;          my ($self, $newObjectType, $fieldHash) = @_;
         my ($newObjectType, $fieldHash) = @_;  
850          # Denote that so far we appear successful.          # Denote that so far we appear successful.
851          my $retVal = 1;          my $retVal = 1;
852          # Get the database handle.          # Get the database handle.
# Line 981  Line 973 
973  =cut  =cut
974  sub LoadTable {  sub LoadTable {
975          # Get the parameters.          # Get the parameters.
976          my $self = shift @_;          my ($self, $fileName, $relationName, $truncateFlag) = @_;
         my ($fileName, $relationName, $truncateFlag) = @_;  
977          # Create the statistical return object.          # Create the statistical return object.
978          my $retVal = _GetLoadStats();          my $retVal = _GetLoadStats();
979          # Trace the fact of the load.          # Trace the fact of the load.
# Line 1109  Line 1100 
1100    
1101  sub GenerateEntity {  sub GenerateEntity {
1102          # Get the parameters.          # Get the parameters.
1103          my $self = shift @_;          my ($self, $id, $type, $values) = @_;
         my ($id, $type, $values) = @_;  
1104          # Create the return hash.          # Create the return hash.
1105          my $this = { id => $id };          my $this = { id => $id };
1106          # Get the metadata structure.          # Get the metadata structure.
# Line 1243  Line 1233 
1233    
1234  sub _DumpRelation {  sub _DumpRelation {
1235          # Get the parameters.          # Get the parameters.
1236          my $self = shift @_;          my ($self, $outputDirectory, $relationName, $relation) = @_;
         my ($outputDirectory, $relationName, $relation) = @_;  
1237          # Open the output file.          # Open the output file.
1238          my $fileName = "$outputDirectory/$relationName.dtx";          my $fileName = "$outputDirectory/$relationName.dtx";
1239          open(DTXOUT, ">$fileName") || Confess("Could not open dump file $fileName: $!");          open(DTXOUT, ">$fileName") || Confess("Could not open dump file $fileName: $!");
# Line 1290  Line 1279 
1279    
1280  sub _GetStructure {  sub _GetStructure {
1281          # Get the parameters.          # Get the parameters.
1282          my $self = shift @_;          my ($self, $objectName) = @_;
         my ($objectName) = @_;  
1283          # Get the metadata structure.          # Get the metadata structure.
1284          my $metadata = $self->{_metaData};          my $metadata = $self->{_metaData};
1285          # Declare the variable to receive the descriptor.          # Declare the variable to receive the descriptor.
# Line 1330  Line 1318 
1318    
1319  sub _GetRelationTable {  sub _GetRelationTable {
1320          # Get the parameters.          # Get the parameters.
1321          my $self = shift @_;          my ($self, $objectName) = @_;
         my ($objectName) = @_;  
1322          # Get the descriptor from the metadata.          # Get the descriptor from the metadata.
1323          my $objectData = $self->_GetStructure($objectName);          my $objectData = $self->_GetStructure($objectName);
1324          # Return the object's relation list.          # Return the object's relation list.
# Line 1360  Line 1347 
1347    
1348  sub _GetFieldTable {  sub _GetFieldTable {
1349          # Get the parameters.          # Get the parameters.
1350          my $self = shift @_;          my ($self, $objectName) = @_;
         my ($objectName) = @_;  
1351          # Get the descriptor from the metadata.          # Get the descriptor from the metadata.
1352          my $objectData = $self->_GetStructure($objectName);          my $objectData = $self->_GetStructure($objectName);
1353          # Return the object's field table.          # Return the object's field table.
# Line 1458  Line 1444 
1444    
1445  sub _LoadRelation {  sub _LoadRelation {
1446          # Get the parameters.          # Get the parameters.
1447          my $self = shift @_;          my ($self, $directoryName, $relationName, $rebuild) = @_;
         my ($directoryName, $relationName, $rebuild) = @_;  
1448          # Create the file name.          # Create the file name.
1449          my $fileName = "$directoryName/$relationName";          my $fileName = "$directoryName/$relationName";
1450          # If the file doesn't exist, try adding the .dtx suffix.          # If the file doesn't exist, try adding the .dtx suffix.
# Line 2113  Line 2098 
2098    
2099  sub _IsPrimary {  sub _IsPrimary {
2100          # Get the parameters.          # Get the parameters.
2101          my $self = shift @_;          my ($self, $relationName) = @_;
         my ($relationName) = @_;  
2102          # Check for the relation in the entity table.          # Check for the relation in the entity table.
2103          my $entityTable = $self->{_metaData}->{Entities};          my $entityTable = $self->{_metaData}->{Entities};
2104          my $retVal = exists $entityTable->{$relationName};          my $retVal = exists $entityTable->{$relationName};
# Line 2148  Line 2132 
2132  =cut  =cut
2133  sub _FindRelation {  sub _FindRelation {
2134          # Get the parameters.          # Get the parameters.
2135          my $self = shift @_;          my ($self, $relationName) = @_;
         my ($relationName) = @_;  
2136          # Get the relation's structure from the master relation table in the metadata structure.          # Get the relation's structure from the master relation table in the metadata structure.
2137          my $metaData = $self->{_metaData};          my $metaData = $self->{_metaData};
2138          my $retVal = $metaData->{RelationTable}->{$relationName};          my $retVal = $metaData->{RelationTable}->{$relationName};

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3