Esempio n. 1
0
  /**
   * This constructor, which should be only package-accessible, is called by BindingScanLoader as it
   * loads BindingScan objects from the database.
   *
   * @param g
   * @param rs
   * @param paramStatement
   * @param regionStatement
   * @throws SQLException
   */
  BindingScan(Genome g, ResultSet rs) throws SQLException {

    genome = g;

    dbid = rs.getInt(1);
    type = rs.getString(2);
    version = rs.getString(3);
  }
Esempio n. 2
0
  /**
   * insertIntoDB is called by the BindingScanLoader object, when it wants to put this BindingScan
   * into the database. Users who want to insert a BindingScan object should call the
   * BindingScanLoader.insertScan() method.
   *
   * @param c
   * @param genomeMap
   * @param ps
   * @param paramps
   * @param regionps
   * @throws SQLException
   */
  void insertIntoDB(java.sql.Connection c, BindingScanGenomeMap genomeMap, PreparedStatement ps)
      throws SQLException {

    if (dbid != -1) {
      throw new IllegalArgumentException();
    }

    ps.setString(1, type);
    ps.setString(2, version);

    ps.executeUpdate();

    Statement s = c.createStatement();
    ResultSet rs = s.executeQuery("select bindingscan_id.currval from dual");
    if (rs.next()) {
      dbid = rs.getInt(1);
    }
    rs.close();
    s.close();

    genomeMap.insertNewMapping(c, dbid, genome.getDBID());
  }
Esempio n. 3
0
 public static int[] getMSPIDs(MSPLocator loc, Connection c) throws SQLException {
   Statement s = c.createStatement();
   String name = loc.getNameVersion().name;
   String version = loc.getNameVersion().version;
   ResultSet rs =
       s.executeQuery(
           "select id from rosettaanalysis where name='"
               + name
               + "' and "
               + "version = '"
               + version
               + "'");
   Vector<Integer> values = new Vector<Integer>();
   while (rs.next()) {
     values.add(rs.getInt(1));
   }
   s.close();
   int[] array = new int[values.size()];
   for (int i = 0; i < values.size(); i++) {
     array[i] = values.get(i);
   }
   Arrays.sort(array);
   return array;
 }