/** * 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); }
/** * 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); }
/** * This call expects only one record in the result set. If multiple records are found an * excpetion is thrown. The ResultSet object is automatically closed by this call. */ public DataPoint getOnlyRecord() { DataPoint ret = null; try { if (m_resultSet.next()) ret = factory.newDataPoint(m_resultSet); if (m_resultSet.next()) throw new GenOrmException("Multiple rows returned in call from DataPoint.getOnlyRecord"); } catch (java.sql.SQLException sqle) { throw new GenOrmException(sqle); } close(); return (ret); }
/** Returns the current record in the result set */ public DataPoint getRecord() { return (factory.newDataPoint(m_resultSet)); }