[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.233, Fri Mar 4 23:16:42 2005 UTC revision 1.234, Sat Mar 5 04:29:59 2005 UTC
# Line 4879  Line 4879 
4879   get_values   get_values
4880   guess_value_format   guess_value_format
4881    
4882    By default all tags are treated as uppercase, and all tags have leading and trailing white space removed.
4883    
4884  =head1 get_attributes  =head1 get_attributes
4885    
4886  With one argument (the id):  With one argument (the id):
# Line 4915  Line 4917 
4917      my($self,$fid, $tag) = @_;      my($self,$fid, $tag) = @_;
4918      my($rdbH,$relational_db_response);      my($rdbH,$relational_db_response);
4919    
4920        $tag =~ s/^\s+//; $tag =~ s/\s+$//; $tag=uc($tag);
4921    
4922      $rdbH = $self->db_handle;      $rdbH = $self->db_handle;
4923    
4924      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\' )")) &&
# Line 4971  Line 4975 
4975  sub add_attribute {  sub add_attribute {
4976      my($self,$peg,$k,$v, $url, $file) = @_;      my($self,$peg,$k,$v, $url, $file) = @_;
4977      return unless ($peg && $k); # we must have at least a peg and a tag to add (though other things can be undef)      return unless ($peg && $k); # we must have at least a peg and a tag to add (though other things can be undef)
4978        $k =~ s/^\s+//; $k =~ s/\s+$//; $k=uc($k);
4979      unless ($file) {$file="assigned_attributes"}      unless ($file) {$file="assigned_attributes"}
4980      my $rdbH = $self->db_handle;      my $rdbH = $self->db_handle;
4981      $rdbH->SQL("INSERT INTO attribute ( fid,tag,val,url ) VALUES ( '$peg','$k','$v','$url')");      $rdbH->SQL("INSERT INTO attribute ( fid,tag,val,url ) VALUES ( '$peg','$k','$v','$url')");
# Line 5018  Line 5023 
5023      my($self,$peg,$k,$v, $url, $file) = @_;      my($self,$peg,$k,$v, $url, $file) = @_;
5024      unless ($file) {$file="assigned_attributes"}      unless ($file) {$file="assigned_attributes"}
5025      return (0) unless ($peg && $k); # we must have at least a peg and a key.      return (0) unless ($peg && $k); # we must have at least a peg and a key.
5026        $k =~ s/^\s+//; $k =~ s/\s+$//; $k=uc($k);
5027      my $rdbH = $self->db_handle;      my $rdbH = $self->db_handle;
5028      $rdbH->SQL("DELETE FROM attribute WHERE fid = \'$peg\' and tag = \'$k\'"); # note that peg can have more than one value.      $rdbH->SQL("DELETE FROM attribute WHERE fid = \'$peg\' and tag = \'$k\'"); # note that peg can have more than one value.
5029      if (defined $v) {      if (defined $v) {
# Line 5060  Line 5066 
5066   my $tags;   my $tags;
5067   foreach my $res (@$relational_db_response) {   foreach my $res (@$relational_db_response) {
5068    my ($fid, $tag)=@$res;    my ($fid, $tag)=@$res;
5069      $tag =~ s/^\s+//; $tag =~ s/\s+$//; $tag=uc($tag);
5070    my $type=$self->ftype($fid);    my $type=$self->ftype($fid);
5071    if ($type && ($want eq $type || $want eq "all")) {    if ($type && ($want eq $type || $want eq "all")) {
5072     $tags->{$type}->{$tag}++;     $tags->{$type}->{$tag}++;
# Line 5103  Line 5110 
5110  =cut  =cut
5111    
5112  sub get_values {  sub get_values {
5113   my ($self, $want, $attr)=@_;   my ($self, $want, $tag)=@_;
5114   unless ($want) {$want="all"}   unless ($want) {$want="all"}
5115   my $rdbH = $self->db_handle;   my $rdbH = $self->db_handle;
5116     $tag =~ s/^\s+//; $tag =~ s/\s+$//; $tag=uc($tag);
5117    
5118   my $sql="SELECT fid,val from attribute";   my $sql="SELECT fid,val from attribute";
5119   if ($attr) {$sql .= " where tag = \'$attr\'"}   if ($tag) {$sql .= " where tag = \'$tag\'"}
5120    
5121   my $relational_db_response=$rdbH->SQL($sql);   my $relational_db_response=$rdbH->SQL($sql);
5122    

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

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3