[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.11, Thu Jun 23 21:24:49 2005 UTC revision 1.13, Fri Jun 24 21:44:54 2005 UTC
# Line 2  Line 2 
2    
3      use strict;      use strict;
4      use Tracer;      use Tracer;
5      use DBKernel;      use DBRtns;
6      use Data::Dumper;      use Data::Dumper;
7      use XML::Simple;      use XML::Simple;
8      use DBQuery;      use DBQuery;
# Line 637  Line 637 
637  C<< $database->CreateIndex($relationName); >>  C<< $database->CreateIndex($relationName); >>
638    
639  Create the indexes for a relation. If a table is being loaded from a large source file (as  Create the indexes for a relation. If a table is being loaded from a large source file (as
640  is the case in L</LoadTable>), it is best to create the indexes after the load. If that is  is the case in L</LoadTable>), it is sometimes best to create the indexes after the load.
641  the case, then L</CreateTable> should be called with the index flag set to FALSE, and this  If that is the case, then L</CreateTable> should be called with the index flag set to
642  method used after the load to create the indexes for the table.  FALSE, and this method used after the load to create the indexes for the table.
643    
644  =cut  =cut
645    
# Line 1379  Line 1379 
1379                  $retVal->AddMessage($@);                  $retVal->AddMessage($@);
1380              }              }
1381          }          }
1382            # Analyze the table to help optimize tables.
1383            $dbh->vacuum_it($relationName);
1384      }      }
1385      # Commit the database changes.      # Commit the database changes.
1386      $dbh->commit_tran;      $dbh->commit_tran;
# Line 2014  Line 2016 
2016      for my $entityName (keys %{$entityList}) {      for my $entityName (keys %{$entityList}) {
2017          my $entityStructure = $entityList->{$entityName};          my $entityStructure = $entityList->{$entityName};
2018          #          #
2019          # The first step is to run creating all the entity's default values. For C<Field> elements,          # The first step is to create all the entity's default values. For C<Field> elements,
2020          # the relation name must be added where it is not specified. For relationships,          # the relation name must be added where it is not specified. For relationships,
2021          # the B<from-link> and B<to-link> fields must be inserted, and for entities an B<id>          # the B<from-link> and B<to-link> fields must be inserted, and for entities an B<id>
2022          # field must be added to each relation. Finally, each field will have a C<PrettySort> attribute          # field must be added to each relation. Finally, each field will have a C<PrettySort> attribute
# Line 2325  Line 2327 
2327      # index descriptor does not exist, it will be created automatically so we can add      # index descriptor does not exist, it will be created automatically so we can add
2328      # the field to it.      # the field to it.
2329      unshift @{$newIndex->{IndexFields}}, $firstField;      unshift @{$newIndex->{IndexFields}}, $firstField;
2330        # If this is a one-to-many relationship, the "To" index is unique.
2331        if ($relationshipStructure->{arity} eq "1M" && $indexKey eq "To") {
2332            $newIndex->{Unique} = 'true';
2333        }
2334      # Add the index to the relation.      # Add the index to the relation.
2335      _AddIndex("idx$relationshipName$indexKey", $relationStructure, $newIndex);      _AddIndex("idx$relationshipName$indexKey", $relationStructure, $newIndex);
2336  }  }

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.13

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3