Example #1
0
  public static void getMaxes(String table, long startDate, long endDate) throws Throwable {

    Connection con = Consts.getConnection();

    ResultSet rs = null;
    ResultSetMetaData rsmd = null;
    PreparedStatement psql = null;

    Hashtable queries = null;

    if (table.equals(Consts.getSpeciesTable())) queries = Util2.getMaxQueriesSpecies(table);

    String strstmt = null;
    String species = null;

    StringBuffer sb = new StringBuffer();

    Iterator it = queries.entrySet().iterator();

    Map.Entry me = null;

    while (it.hasNext()) {

      me = (Map.Entry) it.next();

      strstmt = (String) me.getValue();
      species = (String) me.getKey();
      System.out.println("stmt: " + strstmt);
      psql = con.prepareStatement(strstmt);

      // psql.setDate (1, new java.sql.Date (startDate));
      // psql.setDate (2, new java.sql.Date (endDate));

      try {

        rs = psql.executeQuery();

        addResult(rs, sb, species);
      } catch (Exception e) {
        e.printStackTrace();
      }
    }

    /// not sure how we want to return this. It will probably end up in a grid.
    /// so, even less sure.

    System.out.println(sb.toString());
  }