/**
   * Read all PeMS data in the given time range and having a VDS ID in the given list.
   *
   * @see #read() if you want a transaction and logging around the operation.
   */
  public PeMSSet readSet(Interval interval, List<Long> vdsIds) throws DatabaseException {
    PeMSSet set = new PeMSSet();
    List<PeMSMap> mapList = set.getPemsMapList();

    PeMS pems;
    String query = null;

    try {
      query = runQuerySet(interval, vdsIds);
      org.joda.time.DateTime prevTime = null;
      PeMSMap map = null;

      while (null != (pems = pemsFromQueryRS(query))) {
        org.joda.time.DateTime curTime = pems.getJodaTimeMeasured();

        if (map == null || !prevTime.equals(curTime)) {
          map = new PeMSMap();
          mapList.add(map);
          prevTime = curTime;
        }

        map.getMap().put(pems.getVdsId().toString(), pems);
      }
    } finally {
      if (query != null) {
        dbr.psDestroy(query);
      }
    }

    return set;
  }