Example #1
0
    /**
     * Returns the reults as an ArrayList of Record objects. The Result set is closed within this
     * call
     *
     * @param maxRows if the result set contains more than this param then an exception is thrown
     */
    public ArrayList<DataPoint> getArrayList(int maxRows) {
      ArrayList<DataPoint> results = new ArrayList<DataPoint>();
      int count = 0;

      try {
        if (m_onFirstResult) {
          count++;
          results.add(factory.newDataPoint(m_resultSet));
        }

        while (m_resultSet.next() && (count < maxRows)) {
          count++;
          results.add(factory.newDataPoint(m_resultSet));
        }

        if (m_resultSet.next())
          throw new GenOrmException(
              "Bound of " + maxRows + " is too small for query [" + m_query + "]");
      } catch (java.sql.SQLException sqle) {
        sqle.printStackTrace();
        throw new GenOrmException(sqle);
      }

      close();
      return (results);
    }
Example #2
0
    /**
     * Returns the reults as an ArrayList of Record objects. The Result set is closed within this
     * call
     */
    public ArrayList<DataPoint> getArrayList() {
      ArrayList<DataPoint> results = new ArrayList<DataPoint>();

      try {
        if (m_onFirstResult) results.add(factory.newDataPoint(m_resultSet));

        while (m_resultSet.next()) results.add(factory.newDataPoint(m_resultSet));
      } catch (java.sql.SQLException sqle) {
        sqle.printStackTrace();
        throw new GenOrmException(sqle);
      }

      close();
      return (results);
    }
Example #3
0
    protected DataPointFactoryImpl() {
      m_fieldMeta = new ArrayList<GenOrmFieldMeta>();
      m_fieldMeta.add(ID_FIELD_META);
      m_fieldMeta.add(METRIC_ID_FIELD_META);
      m_fieldMeta.add(TIMESTAMP_FIELD_META);
      m_fieldMeta.add(LONG_VALUE_FIELD_META);
      m_fieldMeta.add(DOUBLE_VALUE_FIELD_META);

      m_foreignKeyConstraints = new ArrayList<GenOrmConstraint>();
      m_foreignKeyConstraints.add(
          new GenOrmConstraint(
              "metric",
              "data_point_metric_id_fkey",
              "CONSTRAINT data_point_metric_id_fkey FOREIGN KEY (\"metric_id\")\n	REFERENCES metric (\"id\")"));
    }