/**
   * Execute a query for the specified pems aggregate data.
   *
   * @return String query string, may be passed to psRSNext or pemsFromQueryRS
   */
  protected String runQueryAggregates(
      Interval interval, List<Long> vdsIds, PeMSAggregate.AggregationLevel level)
      throws DatabaseException {

    String query = "read_pems_aggregates";
    String yuckyuck = org.apache.commons.lang.StringUtils.join(vdsIds, ", ");

    dbr.psCreate(
        query,
        "SELECT * "
            + "FROM VIA."
            + level.table
            + " "
            + "WHERE "
            + "MEASURE_DT BETWEEN ? AND ? "
            + "AND "
            + "VDS_ID IN ("
            + yuckyuck
            + ") "
            + "ORDER BY MEASURE_DT");

    dbr.psClearParams(query);
    dbr.psSetTimestampMilliseconds(query, 1, interval.getStartMillis());
    dbr.psSetTimestampMilliseconds(query, 2, interval.getEndMillis());

    // this doesn't seem to work, hence the yuck hack above:
    // dbr.psSetArrayLong(query, 3, vdsIds.toArray(new Long[vdsIds.size()]));

    dbr.psQuery(query);

    return query;
  }
コード例 #2
0
  /**
   * Execute a query for the specified pems data.
   *
   * @return String query string, may be passed to psRSNext or pemsFromQueryRS
   */
  protected String runQuerySet(Interval interval, List<Long> vdsIds) throws DatabaseException {
    String query = "read_pems_set";
    String yuckyuck = org.apache.commons.lang.StringUtils.join(vdsIds, ", ");

    dbr.psCreate(
        query,
        "SELECT "
            + "VDS_ID, "
            + "MEASURE_DT, "
            + "FLOW, "
            + "DENSITY, "
            + "DENSITY_ERR, "
            + "SPEED, "
            + "SPEED_ERROR, "
            + "FF_SPEED, "
            + "FUNC_LOOP_FACT, "
            + "G_FACTOR_LANE_0, "
            + "G_FACTOR_LANE_1, "
            + "G_FACTOR_LANE_2, "
            + "G_FACTOR_LANE_3, "
            + "G_FACTOR_LANE_4, "
            + "G_FACTOR_LANE_5, "
            + "G_FACTOR_LANE_6, "
            + "G_FACTOR_LANE_7, "
            + "G_FACTOR_LANE_8, "
            + "G_FACTOR_LANE_9 "
            + "FROM VIA.PEMS_30SEC_FILT "
            + "WHERE "
            + "MEASURE_DT BETWEEN ? AND ? "
            + "AND "
            + "VDS_ID IN ("
            + yuckyuck
            + ") "
            + "ORDER BY MEASURE_DT");

    dbr.psClearParams(query);
    dbr.psSetTimestampMilliseconds(query, 1, interval.getStartMillis());
    dbr.psSetTimestampMilliseconds(query, 2, interval.getEndMillis());

    // this doesn't seem to work, hence the yuck hack above:
    // dbr.psSetArrayLong(query, 3, vdsIds.toArray(new Long[vdsIds.size()]));

    dbr.psQuery(query);

    return query;
  }