[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.34, Sat Jan 28 09:54:12 2006 UTC revision 1.35, Sat Jan 28 09:57:43 2006 UTC
# Line 1114  Line 1114 
1114          my $current = pop @todoList;          my $current = pop @todoList;
1115          # Copy it into a list.          # Copy it into a list.
1116          my @stackedPath = @{$current};          my @stackedPath = @{$current};
         Trace("Processing path (" . join(", ", @stackedPath) . ").") if T(4);  
1117          # Pull off the last item on the path. It will always be an entity.          # Pull off the last item on the path. It will always be an entity.
1118          my $entityName = pop @stackedPath;          my $entityName = pop @stackedPath;
1119          # Add it to the alreadyFound list.          # Add it to the alreadyFound list.
# Line 1131  Line 1130 
1130          # Now we need to look for relationships connected to this entity.          # Now we need to look for relationships connected to this entity.
1131          my $relationshipList = $self->{_metaData}->{Relationships};          my $relationshipList = $self->{_metaData}->{Relationships};
1132          for my $relationshipName (keys %{$relationshipList}) {          for my $relationshipName (keys %{$relationshipList}) {
             Trace("Checking relationship $relationshipName.") if T(4);  
1133              my $relationship = $relationshipList->{$relationshipName};              my $relationship = $relationshipList->{$relationshipName};
1134              # Check the FROM field. We're only interested if it's us.              # Check the FROM field. We're only interested if it's us.
1135              if ($relationship->{from} eq $entityName) {              if ($relationship->{from} eq $entityName) {
# Line 1196  Line 1194 
1194                  # Connect the current relationship to the preceding entity.                  # Connect the current relationship to the preceding entity.
1195                  my ($entity, $rel) = @pathTables[$i-1,$i];                  my ($entity, $rel) = @pathTables[$i-1,$i];
1196                  # The style of connection depends on the direction of the relationship.                  # The style of connection depends on the direction of the relationship.
1197                  $stmt .= " AND $entity.id = $rel.from_link";                  $stmt .= " AND $entity.id = $rel.$keyName";
1198                  if ($i + 1 <= $#pathTables) {                  if ($i + 1 <= $#pathTables) {
1199                      # Here there's a next entity, so connect that to the relationship's                      # Here there's a next entity, so connect that to the relationship's
1200                      # to-link.                      # to-link.
1201                      my $entity2 = $pathTables[$i+1];                      my $entity2 = $pathTables[$i+1];
1202                      $stmt .= " AND $rel.$keyName = $entity2.id";                      $stmt .= " AND $rel.to_link = $entity2.id";
1203                  }                  }
1204              }              }
1205              # Now we have our desired DELETE statement.              # Now we have our desired DELETE statement.

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3