[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.406, Thu Dec 8 18:07:54 2005 UTC revision 1.407, Sat Dec 10 18:08:17 2005 UTC
# Line 7999  Line 7999 
7999    
8000      # An error check to make sure that we are operating on the new version of attributes      # An error check to make sure that we are operating on the new version of attributes
8001      # If we are not, we will print an error and then return. Otherwise continue      # If we are not, we will print an error and then return. Otherwise continue
8002      eval {$rdbH->SQL("SELECT genome,ftype,id,key,val,url FROM attribute LIMIT 1")};      eval {$rdbH->SQL("SELECT genome,ftype,id,tag,val,url FROM attribute LIMIT 1")};
8003      if ($@) {return []}      if ($@) {return []}
8004      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}
8005    
# Line 8009  Line 8009 
8009      # and then join the @where into the select statement. The @values is provided to the SQL statement to merge      # and then join the @where into the select statement. The @values is provided to the SQL statement to merge
8010      my @where; my @values;      my @where; my @values;
8011      if ($request[0]) {push @where, qw[genome ftype id]; push @values, $self->split_attribute_oid($request[0])}      if ($request[0]) {push @where, qw[genome ftype id]; push @values, $self->split_attribute_oid($request[0])}
8012      if ($request[1]) {push @where, "key"; push @values, $request[1]}      if ($request[1]) {push @where, "tag"; push @values, $request[1]}
8013      if ($request[2]) {push @where, "val"; push @values, $request[2]}      if ($request[2]) {push @where, "val"; push @values, $request[2]}
8014      if ($request[3]) {push @where, "url"; push @values, $request[3]}      if ($request[3]) {push @where, "url"; push @values, $request[3]}
8015    
8016      my $select = "SELECT genome,ftype,id,key,val,url FROM attribute where (".join(" = ? and ", @where)." = ?)";      my $select = "SELECT genome,ftype,id,tag,val,url FROM attribute where (".join(" = ? and ", @where)." = ?)";
8017      #print STDERR "TRYING: $select and ?=", join(" ?=", @values), "\n";      #print STDERR "TRYING: $select and ?=", join(" ?=", @values), "\n";
8018    
8019      unless (@request)      unless (@request)
8020      {      {
8021       # use an empty SQL query if no request made. This should return everything       # use an empty SQL query if no request made. This should return everything
8022       $select = "SELECT genome,ftype,id,key,val,url FROM attribute";       $select = "SELECT genome,ftype,id,tag,val,url FROM attribute";
8023      }      }
8024    
8025      my $res=$rdbH->SQL($select, undef, @values);      my $res=$rdbH->SQL($select, undef, @values);
# Line 8063  Line 8063 
8063    
8064      # An error check to make sure that we are operating on the new version of attributes      # An error check to make sure that we are operating on the new version of attributes
8065      # If we are not, we will print an error and then return. Otherwise continue      # If we are not, we will print an error and then return. Otherwise continue
8066      eval {$rdbH->SQL("SELECT genome,ftype,id,key,val,url FROM attribute LIMIT 1")};      eval {$rdbH->SQL("SELECT genome,ftype,id,tag,val,url FROM attribute LIMIT 1")};
8067      if ($@) {return []}      if ($@) {return []}
8068      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}
8069    
8070      # split the peg/feature/genome into pieces and parts      # split the peg/feature/genome into pieces and parts
8071      $rdbH->SQL("INSERT INTO attribute ( genome,ftype,id,key,val,url ) VALUES ( ?,?,?,?,?,?)", undef, $self->split_attribute_oid($peg),$k,$v,$url);      $rdbH->SQL("INSERT INTO attribute ( genome,ftype,id,tag,val,url ) VALUES ( ?,?,?,?,?,?)", undef, $self->split_attribute_oid($peg),$k,$v,$url);
8072      my $location=$self->attribute_location($peg);      my $location=$self->attribute_location($peg);
8073      &verify_dir("$location");      &verify_dir("$location");
8074      if (!$notl && open(TMPATTR,">>$location/transaction_log"))      if (!$notl && open(TMPATTR,">>$location/transaction_log"))
# Line 8139  Line 8139 
8139    
8140      # An error check to make sure that we are operating on the new version of attributes      # An error check to make sure that we are operating on the new version of attributes
8141      # If we are not, we will print an error and then return. Otherwise continue      # If we are not, we will print an error and then return. Otherwise continue
8142      eval {$rdbH->SQL("SELECT genome,ftype,id,key,val,url FROM attribute LIMIT 1")};      eval {$rdbH->SQL("SELECT genome,ftype,id,tag,val,url FROM attribute LIMIT 1")};
8143      if ($@) {return []}      if ($@) {return []}
8144      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}
8145    
8146      # Build the delete statement "@boundValues" will be the values replacing the      # Build the delete statement "@boundValues" will be the values replacing the
8147      # parameter marks.      # parameter marks.
8148      my @boundValues = ($self->split_attribute_oid($peg), $k);      my @boundValues = ($self->split_attribute_oid($peg), $k);
8149      my $exc="DELETE FROM attribute WHERE genome = ? and ftype = ? and id = ? and key = ? ";      my $exc="DELETE FROM attribute WHERE genome = ? and ftype = ? and id = ? and tag = ? ";
8150      if ($oldval) {      if ($oldval) {
8151          $exc .= " and val = ?";          $exc .= " and val = ?";
8152          push @boundValues, $oldval;          push @boundValues, $oldval;
# Line 8157  Line 8157 
8157      }      }
8158      $rdbH->SQL($exc, undef, @boundValues);      $rdbH->SQL($exc, undef, @boundValues);
8159      if (defined $newval) {      if (defined $newval) {
8160          $exc = "INSERT INTO attribute (  genome,ftype,id,key,val,url ) VALUES ( ?,?,?,?,?,? )";          $exc = "INSERT INTO attribute (  genome,ftype,id,tag,val,url ) VALUES ( ?,?,?,?,?,? )";
8161          $rdbH->SQL($exc, undef, $self->split_attribute_oid($peg), $k, $newval, $newurl);          $rdbH->SQL($exc, undef, $self->split_attribute_oid($peg), $k, $newval, $newurl);
8162          # write to the transaction log if we add a new value (writing deletes is handled above)          # write to the transaction log if we add a new value (writing deletes is handled above)
8163          my $location = $self->attribute_location($peg);          my $location = $self->attribute_location($peg);
# Line 8391  Line 8391 
8391    
8392   # An error check to make sure that we are operating on the new version of attributes   # An error check to make sure that we are operating on the new version of attributes
8393   # If we are not, we will print an error and then return. Otherwise continue   # If we are not, we will print an error and then return. Otherwise continue
8394   eval {$rdbH->SQL("SELECT genome,ftype,id,key,val,url FROM attribute LIMIT 1")};   eval {$rdbH->SQL("SELECT genome,ftype,id,tag,val,url FROM attribute LIMIT 1")};
8395   if ($@) {return []}   if ($@) {return []}
8396   #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}   #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}
8397    
8398   my $res=$rdbH->SQL("SELECT DISTINCT key from attribute where (genome is not null and ftype = '' and id = '')");   my $res=$rdbH->SQL("SELECT DISTINCT tag from attribute where (genome is not null and ftype = '' and id = '')");
8399   return map {$_->[0]} @$res;   return map {$_->[0]} @$res;
8400  }  }
8401    
# Line 8412  Line 8412 
8412    
8413   # An error check to make sure that we are operating on the new version of attributes   # An error check to make sure that we are operating on the new version of attributes
8414   # If we are not, we will print an error and then return. Otherwise continue   # If we are not, we will print an error and then return. Otherwise continue
8415   eval {$rdbH->SQL("SELECT genome,ftype,id,key,val,url FROM attribute LIMIT 1")};   eval {$rdbH->SQL("SELECT genome,ftype,id,tag,val,url FROM attribute LIMIT 1")};
8416   if ($@) {return []}   if ($@) {return []}
8417   #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}   #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}
8418    
8419   my $res=$rdbH->SQL("SELECT DISTINCT key from attribute where (ftype = 'peg')");   my $res=$rdbH->SQL("SELECT DISTINCT tag from attribute where (ftype = 'peg')");
8420   return map {$_->[0]} @$res;   return map {$_->[0]} @$res;
8421  }  }
8422    
# Line 8472  Line 8472 
8472    
8473   # An error check to make sure that we are operating on the new version of attributes   # An error check to make sure that we are operating on the new version of attributes
8474   # If we are not, we will print an error and then return. Otherwise continue   # If we are not, we will print an error and then return. Otherwise continue
8475   eval {$rdbH->SQL("SELECT genome,ftype,id,key,val,url FROM attribute LIMIT 1")};   eval {$rdbH->SQL("SELECT genome,ftype,id,tag,val,url FROM attribute LIMIT 1")};
8476   if ($@) {return []}   if ($@) {return []}
8477   #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}   #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}
8478    
# Line 8547  Line 8547 
8547    
8548   # An error check to make sure that we are operating on the new version of attributes   # An error check to make sure that we are operating on the new version of attributes
8549   # If we are not, we will print an error and then return. Otherwise continue   # If we are not, we will print an error and then return. Otherwise continue
8550   eval {$rdbH->SQL("SELECT genome,ftype,id,key,val,url FROM attribute LIMIT 1")};   eval {$rdbH->SQL("SELECT genome,ftype,id,tag,val,url FROM attribute LIMIT 1")};
8551   if ($@) {return []}   if ($@) {return []}
8552   #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}   #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}
8553    
# Line 8612  Line 8612 
8612   $tag =~ s/^\s+//; $tag =~ s/\s+$//; $tag=uc($tag);   $tag =~ s/^\s+//; $tag =~ s/\s+$//; $tag=uc($tag);
8613    
8614   my $sql="SELECT genome, ftype, id ,val FROM attribute";   my $sql="SELECT genome, ftype, id ,val FROM attribute";
8615   if ($tag) {$sql .= " WHERE key = \'$tag\'"}   if ($tag) {$sql .= " WHERE tag = \'$tag\'"}
8616    
8617   my $relational_db_response=$rdbH->SQL($sql);   my $relational_db_response=$rdbH->SQL($sql);
8618    
# Line 8823  Line 8823 
8823    
8824      # An error check to make sure that we are operating on the new version of attributes      # An error check to make sure that we are operating on the new version of attributes
8825      # If we are not, we will print an error and then return. Otherwise continue      # If we are not, we will print an error and then return. Otherwise continue
8826      eval {$rdbH->SQL("SELECT genome,ftype,id,key,val,url FROM attribute LIMIT 1")};      eval {$rdbH->SQL("SELECT genome,ftype,id,tag,val,url FROM attribute LIMIT 1")};
8827      if ($@) {return []}      if ($@) {return []}
8828      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}
8829    
8830      my $theTerm = uc( $searchTerm );      my $theTerm = uc( $searchTerm );
8831      my $relational_db_response=$rdbH->SQL("SELECT genome,ftype,id,key,val from attribute WHERE UPPER(key) LIKE '%$theTerm%' OR UPPER(val) LIKE '%$theTerm%'");      my $relational_db_response=$rdbH->SQL("SELECT genome,ftype,id,tag,val from attribute WHERE UPPER(tag) LIKE '%$theTerm%' OR UPPER(val) LIKE '%$theTerm%'");
8832    
8833      my @results;      my @results;
8834      foreach my $res (@$relational_db_response) {      foreach my $res (@$relational_db_response) {
# Line 8855  Line 8855 
8855    
8856      # An error check to make sure that we are operating on the new version of attributes      # An error check to make sure that we are operating on the new version of attributes
8857      # If we are not, we will print an error and then return. Otherwise continue      # If we are not, we will print an error and then return. Otherwise continue
8858      eval {$rdbH->SQL("SELECT genome,ftype,id,key,val,url FROM attribute LIMIT 1")};      eval {$rdbH->SQL("SELECT genome,ftype,id,tag,val,url FROM attribute LIMIT 1")};
8859      if ($@) {return []}      if ($@) {return []}
8860      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}      #if ($@) {print STDERR "Please rerun load_attributes to install the newest set of attributes\n"; return []}
8861    
8862      my $relational_db_response=$rdbH->SQL("SELECT genome,ftype,id,key,val from attribute WHERE key LIKE '%$searchTerm%' OR val LIKE '%$searchTerm%'");      my $relational_db_response=$rdbH->SQL("SELECT genome,ftype,id,tag,val from attribute WHERE tag LIKE '%$searchTerm%' OR val LIKE '%$searchTerm%'");
8863      my @results;      my @results;
8864    
8865      foreach my $res (@$relational_db_response) {      foreach my $res (@$relational_db_response) {

Legend:
Removed from v.1.406  
changed lines
  Added in v.1.407

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3