[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.75, Thu Nov 9 21:21:49 2006 UTC revision 1.76, Wed Nov 15 12:08:26 2006 UTC
# Line 1099  Line 1099 
1099  =item id  =item id
1100    
1101  ID of the entity instance to be processed. If the instance is not found, this  ID of the entity instance to be processed. If the instance is not found, this
1102  method will have no effect.  method will have no effect. If C<undef> is specified, all values for all of
1103    the entity instances will be deleted.
1104    
1105  =item fieldName  =item fieldName
1106    
# Line 1134  Line 1135 
1135          Confess("Cannot delete values of $fieldName for $entityName.");          Confess("Cannot delete values of $fieldName for $entityName.");
1136      } else {      } else {
1137          # Set up the SQL command to delete all values.          # Set up the SQL command to delete all values.
1138          my $sql = "DELETE FROM $relation WHERE id = ?";          my $sql = "DELETE FROM $relation";
1139          my @parms = $id;          # Build the filter.
1140          # If a value has been specified, append it to the statement.          my @filters = ();
1141            my @parms = ();
1142            # Check for a filter by ID.
1143            if (defined $id) {
1144                push @filters, "id = ?";
1145                push @parms, $id;
1146            }
1147            # Check for a filter by value.
1148          if (defined $fieldValue) {          if (defined $fieldValue) {
1149              $sql .= " AND $fieldName = ?";              push @filters, "$fieldName = ?";
1150              push @parms, $fieldValue;              push @parms, $fieldValue;
1151          }          }
1152            # Append the filters to the command.
1153            if (@filters) {
1154                $sql .= " WHERE " . join(" AND ", @filters);
1155            }
1156          # Execute the command.          # Execute the command.
1157          my $dbh = $self->{_dbh};          my $dbh = $self->{_dbh};
1158          $retVal = $dbh->SQL($sql, 0, @parms);          $retVal = $dbh->SQL($sql, 0, @parms);

Legend:
Removed from v.1.75  
changed lines
  Added in v.1.76

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3