[Bio] / FigKernelPackages / FIG.pm Repository:
ViewVC logotype

Diff of /FigKernelPackages/FIG.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.232, Fri Mar 4 22:37:06 2005 UTC revision 1.233, Fri Mar 4 23:16:42 2005 UTC
# Line 4920  Line 4920 
4920      if ($tag && ($relational_db_response = $rdbH->SQL("SELECT val,url FROM attribute WHERE ( fid = \'$fid\' and tag = \'$tag\' )")) &&      if ($tag && ($relational_db_response = $rdbH->SQL("SELECT val,url FROM attribute WHERE ( fid = \'$fid\' and tag = \'$tag\' )")) &&
4921              (@$relational_db_response > 0))              (@$relational_db_response > 0))
4922      {      {
4923          return @{$relational_db_response->[0]}          my @arr=@$relational_db_response;
4924            my $lastarray=$arr[$#arr]; # if we have several values for this tag, we just want the last one!
4925            return @$lastarray;
4926      }      }
4927      elsif (($relational_db_response = $rdbH->SQL("SELECT tag,val,url FROM attribute WHERE ( fid = \'$fid\' )")) &&      elsif (!$tag && ($relational_db_response = $rdbH->SQL("SELECT tag,val,url FROM attribute WHERE ( fid = \'$fid\' )")) &&
4928              (@$relational_db_response > 0))              (@$relational_db_response > 0))
4929      {      {
4930          return @$relational_db_response;          return @$relational_db_response;
# Line 5146  Line 5148 
5148   # I am using self->{'value_format'} to save the format so if this is called multiple times it is not recalculated each time   # I am using self->{'value_format'} to save the format so if this is called multiple times it is not recalculated each time
5149   return $self->{'value_format'}->{$tag} if (defined $self->{'value_format'}->{$tag});   return $self->{'value_format'}->{$tag} if (defined $self->{'value_format'}->{$tag});
5150    
5151   my @values = $self->get_values(undef, $tag);   my $hash = $self->get_values(undef, $tag);
5152   return unless (scalar @values); # if there is no data there is nothing to get!   return if (!$hash || !scalar keys %$hash); # don't carry on if there is nothing to look at
5153    
5154   my ($min, $max)=(100000000, 0);   my ($min, $max)=(100000000, 0);
5155   foreach (@values) {   foreach my $type (keys %$hash) {
5156      foreach my $val (keys %{$hash->{$type}}) {
5157        print STDERR "GOT |$val| for $tag\n";
5158    
5159    # this code is taken from the perl cookbook pg 44    # this code is taken from the perl cookbook pg 44
5160    # it should detect for all nummbers    # it should detect for all nummbers
5161    if ($_ !~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) {      if ($val !~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/) {
5162     undef $min;     undef $min;
5163     undef $max;     undef $max;
5164     last;     last;
# Line 5162  Line 5168 
5168     if ($_ < $min) {$min=$_}     if ($_ < $min) {$min=$_}
5169    }    }
5170   }   }
5171     }
5172   # if $min and $max are defined then the value is a number   # if $min and $max are defined then the value is a number
5173   # if not, then it is a string;   # if not, then it is a string;
5174    

Legend:
Removed from v.1.232  
changed lines
  Added in v.1.233

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3