[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.5, Tue Apr 5 05:17:01 2005 UTC revision 1.7, Thu May 5 03:14:03 2005 UTC
# Line 1  Line 1 
1  package ERDB;  package ERDB;
2    
3          use strict;          use strict;
         use Carp;  
4          use Tracer;          use Tracer;
5          use DBKernel;          use DBKernel;
6          use Data::Dumper;          use Data::Dumper;
# Line 140  Line 139 
139                                   _metaData => $metaData                                   _metaData => $metaData
140                             };                             };
141          # Bless and return it.          # Bless and return it.
142          bless $self;          bless $self, $class;
143          return $self;          return $self;
144  }  }
145    
# Line 278  Line 277 
277          print HTMLOUT _OpenTable("Join Table", "Source", "Target", "Join Condition");          print HTMLOUT _OpenTable("Join Table", "Source", "Target", "Join Condition");
278          # Loop through the joins.          # Loop through the joins.
279          my $joinTable = $metadata->{Joins};          my $joinTable = $metadata->{Joins};
280          for my $joinKey (sort keys %{$joinTable}) {          my @joinKeys = keys %{$joinTable};
281            for my $joinKey (sort @joinKeys) {
282                  # Separate out the source, the target, and the join clause.                  # Separate out the source, the target, and the join clause.
283                  $joinKey =~ m!([^/]*)/(.*)$!;                  $joinKey =~ m!^([^/]+)/(.+)$!;
284                  my ($source, $target, $clause) = ($self->ComputeObjectSentence($1),                  my ($sourceRelation, $targetRelation) = ($1, $2);
285                                                                                    $self->ComputeObjectSentence($2),                  Trace("Join with key $joinKey is from $sourceRelation to $targetRelation.") if T(4);
286                                                                                    $joinTable->{$joinKey});                  my $source = $self->ComputeObjectSentence($sourceRelation);
287                    my $target = $self->ComputeObjectSentence($targetRelation);
288                    my $clause = $joinTable->{$joinKey};
289                  # Display them in a table row.                  # Display them in a table row.
290                  print HTMLOUT "<tr><td>$source</td><td>$target</td><td>$clause</td></tr>\n";                  print HTMLOUT "<tr><td>$source</td><td>$target</td><td>$clause</td></tr>\n";
291          }          }
# Line 328  Line 330 
330          my $metadata = $self->{_metaData};          my $metadata = $self->{_metaData};
331          my $dbh = $self->{_dbh};          my $dbh = $self->{_dbh};
332          # Loop through the entities.          # Loop through the entities.
333          while (my ($entityName, $entityData) = each %{$metadata->{Entities}}) {          my $entityHash = $metadata->{Entities};
334            for my $entityName (keys %{$entityHash}) {
335                    my $entityData = $entityHash->{$entityName};
336                  # Tell the user what we're doing.                  # Tell the user what we're doing.
337                  Trace("Creating relations for entity $entityName.") if T(1);                  Trace("Creating relations for entity $entityName.") if T(1);
338                  # Loop through the entity's relations.                  # Loop through the entity's relations.
# Line 423  Line 427 
427          # Get the database handle.          # Get the database handle.
428          my $dbh = $self->{_dbh};          my $dbh = $self->{_dbh};
429          # Now we need to create this relation's indexes. We do this by looping through its index table.          # Now we need to create this relation's indexes. We do this by looping through its index table.
430          while (my ($indexName, $indexData) = each %{$relationData->{Indexes}}) {          my $indexHash = $relationData->{Indexes};
431            for my $indexName (keys %{$indexHash}) {
432                    my $indexData = $indexHash->{$indexName};
433                  # Get the index's field list.                  # Get the index's field list.
434                  my @fieldList = _FixNames(@{$indexData->{IndexFields}});                  my @fieldList = _FixNames(@{$indexData->{IndexFields}});
435                  my $flds = join(', ', @fieldList);                  my $flds = join(', ', @fieldList);
# Line 739  Line 745 
745          return $retVal;          return $retVal;
746  }  }
747    
748    =head3 GetList
749    
750    C<< my @dbObjects = $database->GetList(\@objectNames, $filterClause, $param1, $param2, ..., $paramN); >>
751    
752    Return a list of object descriptors for the specified objects as determined by the
753    specified filter clause.
754    
755    This method is essentially the same as L</Get> except it returns a list of objects rather
756    than a query object that can be used to get the results one record at a time.
757    
758    =over 4
759    
760    =item objectNames
761    
762    List containing the names of the entity and relationship objects to be retrieved.
763    
764    =item filterClause
765    
766    WHERE clause (without the WHERE) to be used to filter and sort the query. The WHERE clause can
767    be parameterized with parameter markers (C<?>). Each field used in the WHERE clause must be
768    specified in the standard form B<I<objectName>(I<fieldName>)>. Any parameters specified
769    in the filter clause should be added to the parameter list as additional parameters. The
770    fields in a filter clause can come from primary entity relations, relationship relations,
771    or secondary entity relations; however, all of the entities and relationships involved must
772    be included in the list of object names.
773    
774    The filter clause can also specify a sort order. To do this, simply follow the filter string
775    with an ORDER BY clause. For example, the following filter string gets all genomes for a
776    particular genus and sorts them by species name.
777    
778    C<< "Genome(genus) = ? ORDER BY Genome(species)" >>
779    
780    The rules for field references in a sort order are the same as those for field references in the
781    filter clause in general; however, odd things may happen if a sort field is from a secondary
782    relation.
783    
784    =item param1, param2, ..., paramN
785    
786    Parameter values to be substituted into the filter clause.
787    
788    =item RETURN
789    
790    Returns a list of B<DBObject>s that satisfy the query conditions.
791    
792    =back
793    
794    =cut
795    #: Return Type @%
796    sub GetList {
797        # Get the parameters.
798        my ($self, $objectNames, $filterClause, @params) = @_;
799            # Declare the return variable.
800            my @retVal = ();
801            # Perform the query.
802            my $query = $self->Get($objectNames, $filterClause, @params);
803            # Loop through the results.
804            while (my $object = $query->Fetch) {
805                    push @retVal, $object;
806            }
807        # Return the result.
808        return @retVal;
809    }
810    
811  =head3 ComputeObjectSentence  =head3 ComputeObjectSentence
812    
813  C<< my $sentence = $database->ComputeObjectSentence($objectName); >>  C<< my $sentence = $database->ComputeObjectSentence($objectName); >>
# Line 797  Line 866 
866          # 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.
867          my $metaData = $self->{_metaData};          my $metaData = $self->{_metaData};
868          my $entities = $metaData->{Entities};          my $entities = $metaData->{Entities};
869          while (my ($entityName, $entityStructure) = each %{$entities}) {          for my $entityName (keys %{$entities}) {
870                    my $entityStructure = $entities->{$entityName};
871                  # Get the entity's relations.                  # Get the entity's relations.
872                  my $relationList = $entityStructure->{Relations};                  my $relationList = $entityStructure->{Relations};
873                  # Loop through the relations, dumping them.                  # Loop through the relations, dumping them.
874                  while (my ($relationName, $relation) = each %{$relationList}) {                  for my $relationName (keys %{$relationList}) {
875                            my $relation = $relationList->{$relationName};
876                          $self->_DumpRelation($outputDirectory, $relationName, $relation);                          $self->_DumpRelation($outputDirectory, $relationName, $relation);
877                  }                  }
878          }          }
879          # Next, we loop through the relationships.          # Next, we loop through the relationships.
880          my $relationships = $metaData->{Relationships};          my $relationships = $metaData->{Relationships};
881          while (my ($relationshipName, $relationshipStructure) = each %{$relationships}) {          for my $relationshipName (keys %{$relationships}) {
882                    my $relationshipStructure = $relationships->{$relationshipName};
883                  # Dump this relationship's relation.                  # Dump this relationship's relation.
884                  $self->_DumpRelation($outputDirectory, $relationshipName, $relationshipStructure->{Relations}->{$relationshipName});                  $self->_DumpRelation($outputDirectory, $relationshipName, $relationshipStructure->{Relations}->{$relationshipName});
885          }          }
# Line 861  Line 933 
933          # Loop through the relations. We'll build insert statements for each one. If a relation is          # Loop through the relations. We'll build insert statements for each one. If a relation is
934          # secondary, we may end up generating multiple insert statements. If an error occurs, we          # secondary, we may end up generating multiple insert statements. If an error occurs, we
935          # stop the loop.          # stop the loop.
936          while ($retVal && (my ($relationName, $relationDefinition) = each %{$relationTable})) {          my @relationList = keys %{$relationTable};
937            for (my $i = 0; $retVal && $i <= $#relationList; $i++) {
938                    my $relationName = $relationList[$i];
939                    my $relationDefinition = $relationTable->{$relationName};
940                  # Get the relation's fields. For each field we will collect a value in the corresponding                  # Get the relation's fields. For each field we will collect a value in the corresponding
941                  # position of the @valueList array. If one of the fields is missing, we will add it to the                  # position of the @valueList array. If one of the fields is missing, we will add it to the
942                  # @missing list.                  # @missing list.
# Line 1123  Line 1198 
1198          return $this;          return $this;
1199  }  }
1200    
1201    =head3 GetEntity
1202    
1203    C<< my $entityObject = $sprout->GetEntity($entityType, $ID); >>
1204    
1205    Return an object describing the entity instance with a specified ID.
1206    
1207    =over 4
1208    
1209    =item entityType
1210    
1211    Entity type name.
1212    
1213    =item ID
1214    
1215    ID of the desired entity.
1216    
1217    =item RETURN
1218    
1219    Returns a B<DBObject> representing the desired entity instance, or an undefined value if no
1220    instance is found with the specified key.
1221    
1222    =back
1223    
1224    =cut
1225    
1226    sub GetEntity {
1227            # Get the parameters.
1228            my ($self, $entityType, $ID) = @_;
1229            # Create a query.
1230            my $query = $self->Get([$entityType], "$entityType(id) = ?", $ID);
1231            # Get the first (and only) object.
1232            my $retVal = $query->Fetch();
1233            # Return the result.
1234            return $retVal;
1235    }
1236    
1237    =head3 GetEntityValues
1238    
1239    C<< my @values = GetEntityValues($entityType, $ID, \@fields); >>
1240    
1241    Return a list of values from a specified entity instance.
1242    
1243    =over 4
1244    
1245    =item entityType
1246    
1247    Entity type name.
1248    
1249    =item ID
1250    
1251    ID of the desired entity.
1252    
1253    =item fields
1254    
1255    List of field names, each of the form I<objectName>C<(>I<fieldName>C<)>.
1256    
1257    =item RETURN
1258    
1259    Returns a flattened list of the values of the specified fields for the specified entity.
1260    
1261    =back
1262    
1263    =cut
1264    
1265    sub GetEntityValues {
1266            # Get the parameters.
1267            my ($self, $entityType, $ID, $fields) = @_;
1268            # Get the specified entity.
1269            my $entity = $self->GetEntity($entityType, $ID);
1270            # Declare the return list.
1271            my @retVal = ();
1272            # If we found the entity, push the values into the return list.
1273            if ($entity) {
1274                    push @retVal, $entity->Values($fields);
1275            }
1276            # Return the result.
1277            return @retVal;
1278    }
1279    
1280    =head3 GetAll
1281    
1282    C<< my @list = $sprout->GetAll(\@objectNames, $filterClause, \@parameters, \@fields, $count); >>
1283    
1284    Return a list of values taken from the objects returned by a query. The first three
1285    parameters correspond to the parameters of the L</Get> method. The final parameter is
1286    a list of the fields desired from each record found by the query. The field name
1287    syntax is the standard syntax used for fields in the B<ERDB> system--
1288    B<I<objectName>(I<fieldName>)>-- where I<objectName> is the name of the relevant entity
1289    or relationship and I<fieldName> is the name of the field.
1290    
1291    The list returned will be a list of lists. Each element of the list will contain
1292    the values returned for the fields specified in the fourth parameter. If one of the
1293    fields specified returns multiple values, they are flattened in with the rest. For
1294    example, the following call will return a list of the features in a particular
1295    spreadsheet cell, and each feature will be represented by a list containing the
1296    feature ID followed by all of its aliases.
1297    
1298    C<< $query = $sprout->Get(['ContainsFeature', 'Feature'], "ContainsFeature(from-link) = ?", [$ssCellID], ['Feature(id)', 'Feature(alias)']); >>
1299    
1300    =over 4
1301    
1302    =item objectNames
1303    
1304    List containing the names of the entity and relationship objects to be retrieved.
1305    
1306    =item filterClause
1307    
1308    WHERE/ORDER BY clause (without the WHERE) to be used to filter and sort the query. The WHERE clause can
1309    be parameterized with parameter markers (C<?>). Each field used must be specified in the standard form
1310    B<I<objectName>(I<fieldName>)>. Any parameters specified in the filter clause should be added to the
1311    parameter list as additional parameters. The fields in a filter clause can come from primary
1312    entity relations, relationship relations, or secondary entity relations; however, all of the
1313    entities and relationships involved must be included in the list of object names.
1314    
1315    =item parameterList
1316    
1317    List of the parameters to be substituted in for the parameters marks in the filter clause.
1318    
1319    =item fields
1320    
1321    List of the fields to be returned in each element of the list returned.
1322    
1323    =item count
1324    
1325    Maximum number of records to return. If omitted or 0, all available records will be returned.
1326    
1327    =item RETURN
1328    
1329    Returns a list of list references. Each element of the return list contains the values for the
1330    fields specified in the B<fields> parameter.
1331    
1332    =back
1333    
1334    =cut
1335    #: Return Type @@;
1336    sub GetAll {
1337            # Get the parameters.
1338            my ($self, $objectNames, $filterClause, $parameterList, $fields, $count) = @_;
1339            # Translate the parameters from a list reference to a list. If the parameter
1340            # list is a scalar we convert it into a singleton list.
1341            my @parmList = ();
1342            if (ref $parameterList eq "ARRAY") {
1343                    @parmList = @{$parameterList};
1344            } else {
1345                    push @parmList, $parameterList;
1346            }
1347            # Create the query.
1348            my $query = $self->Get($objectNames, $filterClause, @parmList);
1349            # Set up a counter of the number of records read.
1350            my $fetched = 0;
1351            # Insure the counter has a value.
1352            if (!defined $count) {
1353                    $count = 0;
1354            }
1355            # Loop through the records returned, extracting the fields. Note that if the
1356            # counter is non-zero, we stop when the number of records read hits the count.
1357            my @retVal = ();
1358            while (($count == 0 || $fetched < $count) && (my $row = $query->Fetch())) {
1359                    my @rowData = $row->Values($fields);
1360                    push @retVal, \@rowData;
1361                    $fetched++;
1362            }
1363            # Return the resulting list.
1364            return @retVal;
1365    }
1366    
1367  =head2 Internal Utility Methods  =head2 Internal Utility Methods
1368    
# Line 1523  Line 1763 
1763          my %masterRelationTable = ();          my %masterRelationTable = ();
1764          # Loop through the entities.          # Loop through the entities.
1765          my $entityList = $metadata->{Entities};          my $entityList = $metadata->{Entities};
1766          while (my ($entityName, $entityStructure) = each %{$entityList}) {          for my $entityName (keys %{$entityList}) {
1767                    my $entityStructure = $entityList->{$entityName};
1768                  #                  #
1769                  # The first step is to run creating all the entity's default values. For C<Field> elements,                  # The first step is to run creating all the entity's default values. For C<Field> elements,
1770                  # 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,
# Line 1571  Line 1812 
1812                  # to a list of fields. First, we need the ID field itself.                  # to a list of fields. First, we need the ID field itself.
1813                  my $idField = $fieldList->{id};                  my $idField = $fieldList->{id};
1814                  # Loop through the relations.                  # Loop through the relations.
1815                  while (my ($relationName, $relation) = each %{$relationTable}) {                  for my $relationName (keys %{$relationTable}) {
1816                            my $relation = $relationTable->{$relationName};
1817                          # Get the relation's field list.                          # Get the relation's field list.
1818                          my $relationFieldList = $relation->{Fields};                          my $relationFieldList = $relation->{Fields};
1819                          # Add the ID field to it. If the field's already there, it will not make any                          # Add the ID field to it. If the field's already there, it will not make any
# Line 1621  Line 1863 
1863                  # The next step is to insure that each relation has at least one index that begins with the ID field.                  # The next step is to insure that each relation has at least one index that begins with the ID field.
1864                  # After that, we convert each relation's index list to an index table. We first need to loop through                  # After that, we convert each relation's index list to an index table. We first need to loop through
1865                  # the relations.                  # the relations.
1866                  while (my ($relationName, $relation) = each %{$relationTable}) {                  for my $relationName (keys %{$relationTable}) {
1867                            my $relation = $relationTable->{$relationName};
1868                          # Get the relation's index list.                          # Get the relation's index list.
1869                          my $indexList = $relation->{Indexes};                          my $indexList = $relation->{Indexes};
1870                          # Insure this relation has an ID index.                          # Insure this relation has an ID index.
# Line 1652  Line 1895 
1895          # Loop through the relationships. Relationships actually turn out to be much simpler than entities.          # Loop through the relationships. Relationships actually turn out to be much simpler than entities.
1896          # For one thing, there is only a single constituent relation.          # For one thing, there is only a single constituent relation.
1897          my $relationshipList = $metadata->{Relationships};          my $relationshipList = $metadata->{Relationships};
1898          while (my ($relationshipName, $relationshipStructure) = each %{$relationshipList}) {          for my $relationshipName (keys %{$relationshipList}) {
1899                    my $relationshipStructure = $relationshipList->{$relationshipName};
1900                  # Fix up this relationship.                  # Fix up this relationship.
1901                  _FixupFields($relationshipStructure, $relationshipName, 2, 3);                  _FixupFields($relationshipStructure, $relationshipName, 2, 3);
1902                  # Format a description for the FROM field.                  # Format a description for the FROM field.
# Line 1701  Line 1945 
1945                  my @fromList = ();                  my @fromList = ();
1946                  my @toList = ();                  my @toList = ();
1947                  my @bothList = ();                  my @bothList = ();
1948                  while (my ($relationshipName, $relationship) = each %{$relationshipList}) {                  Trace("Join table build for $entityName.") if T(3);
1949                    for my $relationshipName (keys %{$relationshipList}) {
1950                            my $relationship = $relationshipList->{$relationshipName};
1951                          # Determine if this relationship has our entity in one of its link fields.                          # Determine if this relationship has our entity in one of its link fields.
1952                          if ($relationship->{from} eq $entityName) {                          my $fromEntity = $relationship->{from};
1953                                  if ($relationship->{to} eq $entityName) {                          my $toEntity = $relationship->{to};
1954                            Trace("Join check for relationship $relationshipName from $fromEntity to $toEntity.") if T(3);
1955                            if ($fromEntity eq $entityName) {
1956                                    if ($toEntity eq $entityName) {
1957                                          # Here the relationship is recursive.                                          # Here the relationship is recursive.
1958                                          push @bothList, $relationshipName;                                          push @bothList, $relationshipName;
1959                                            Trace("Relationship $relationshipName put in both-list.") if T(3);
1960                                  } else {                                  } else {
1961                                          # Here the relationship comes from the entity.                                          # Here the relationship comes from the entity.
1962                                          push @fromList, $relationshipName;                                          push @fromList, $relationshipName;
1963                                            Trace("Relationship $relationshipName put in from-list.") if T(3);
1964                                  }                                  }
1965                          } elsif ($relationship->{to} eq $entityName) {                          } elsif ($toEntity eq $entityName) {
1966                                  # Here the relationship goes to the entity.                                  # Here the relationship goes to the entity.
1967                                  push @toList, $relationshipName;                                  push @toList, $relationshipName;
1968                                    Trace("Relationship $relationshipName put in to-list.") if T(3);
1969                          }                          }
1970                  }                  }
1971                  # Create the nonrecursive joins. Note that we build two hashes for running                  # Create the nonrecursive joins. Note that we build two hashes for running
# Line 1722  Line 1974 
1974                  # hash table at the same time.                  # hash table at the same time.
1975                  my %directRelationships = ( from => \@fromList, to => \@toList );                  my %directRelationships = ( from => \@fromList, to => \@toList );
1976                  my %otherRelationships = ( from => \@fromList, to => \@toList );                  my %otherRelationships = ( from => \@fromList, to => \@toList );
1977                  while (my ($linkType, $relationships) = each %directRelationships) {                  for my $linkType (keys %directRelationships) {
1978                            my $relationships = $directRelationships{$linkType};
1979                          # Loop through all the relationships.                          # Loop through all the relationships.
1980                          for my $relationshipName (@{$relationships}) {                          for my $relationshipName (@{$relationships}) {
1981                                  # Create joins between the entity and this relationship.                                  # Create joins between the entity and this relationship.
1982                                  my $linkField = "$relationshipName.${linkType}_link";                                  my $linkField = "$relationshipName.${linkType}_link";
1983                                  my $joinClause = "$entityName.id = $linkField";                                  my $joinClause = "$entityName.id = $linkField";
1984                                    Trace("Entity join clause is $joinClause for $entityName and $relationshipName.") if T(4);
1985                                  $joinTable{"$entityName/$relationshipName"} = $joinClause;                                  $joinTable{"$entityName/$relationshipName"} = $joinClause;
1986                                  $joinTable{"$relationshipName/$entityName"} = $joinClause;                                  $joinTable{"$relationshipName/$entityName"} = $joinClause;
1987                                  # Create joins between this relationship and the other relationships.                                  # Create joins between this relationship and the other relationships.
1988                                  while (my ($otherType, $otherships) = each %otherRelationships) {                                  for my $otherType (keys %otherRelationships) {
1989                                            my $otherships = $otherRelationships{$otherType};
1990                                          for my $otherName (@{$otherships}) {                                          for my $otherName (@{$otherships}) {
1991                                                  # Get the key for this join.                                                  # Get the key for this join.
1992                                                  my $joinKey = "$otherName/$relationshipName";                                                  my $joinKey = "$otherName/$relationshipName";
# Line 1741  Line 1996 
1996                                                          # path is ambiguous. We delete the join from the join                                                          # path is ambiguous. We delete the join from the join
1997                                                          # table to prevent it from being used.                                                          # table to prevent it from being used.
1998                                                          delete $joinTable{$joinKey};                                                          delete $joinTable{$joinKey};
1999                                                            Trace("Deleting ambiguous join $joinKey.") if T(4);
2000                                                  } elsif ($otherName ne $relationshipName) {                                                  } elsif ($otherName ne $relationshipName) {
2001                                                          # Here we have a valid join. Note that joins between a                                                          # Here we have a valid join. Note that joins between a
2002                                                          # relationship and itself are prohibited.                                                          # relationship and itself are prohibited.
2003                                                          $joinTable{$joinKey} = "$otherName.${otherType}_link = $linkField";                                                          my $relJoinClause = "$otherName.${otherType}_link = $linkField";
2004                                                            $joinTable{$joinKey} = $relJoinClause;
2005                                                            Trace("Relationship join clause is $relJoinClause for $joinKey.") if T(4);
2006                                                  }                                                  }
2007                                          }                                          }
2008                                  }                                  }
# Line 1753  Line 2011 
2011                                  # relationship can only be ambiguous with another recursive relationship,                                  # relationship can only be ambiguous with another recursive relationship,
2012                                  # and the incoming relationship from the outer loop is never recursive.                                  # and the incoming relationship from the outer loop is never recursive.
2013                                  for my $otherName (@bothList) {                                  for my $otherName (@bothList) {
2014                                            Trace("Setting up relationship joins to recursive relationship $otherName with $relationshipName.") if T(3);
2015                                          # Join from the left.                                          # Join from the left.
2016                                          $joinTable{"$relationshipName/$otherName"} =                                          $joinTable{"$relationshipName/$otherName"} =
2017                                                  "$linkField = $otherName.from_link";                                                  "$linkField = $otherName.from_link";
# Line 1767  Line 2026 
2026                  # rise to situations where we can't create the path we want; however, it is always                  # rise to situations where we can't create the path we want; however, it is always
2027                  # possible to get the same effect using multiple queries.                  # possible to get the same effect using multiple queries.
2028                  for my $relationshipName (@bothList) {                  for my $relationshipName (@bothList) {
2029                            Trace("Setting up entity joins to recursive relationship $relationshipName with $entityName.") if T(3);
2030                          # Join to the entity from each direction.                          # Join to the entity from each direction.
2031                          $joinTable{"$entityName/$relationshipName"} =                          $joinTable{"$entityName/$relationshipName"} =
2032                                  "$entityName.id = $relationshipName.from_link";                                  "$entityName.id = $relationshipName.from_link";
# Line 1906  Line 2166 
2166                  $structure->{Fields} = { };                  $structure->{Fields} = { };
2167          } else {          } else {
2168                  # Here we have a field list. Loop through its fields.                  # Here we have a field list. Loop through its fields.
2169                  while (my ($fieldName, $fieldData) = each %{$structure->{Fields}}) {                  my $fieldStructures = $structure->{Fields};
2170                    for my $fieldName (keys %{$fieldStructures}) {
2171                            my $fieldData = $fieldStructures->{$fieldName};
2172                          # Get the field type.                          # Get the field type.
2173                          my $type = $fieldData->{type};                          my $type = $fieldData->{type};
2174                          # Plug in a relation name if it is needed.                          # Plug in a relation name if it is needed.

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.7

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3