--- dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/Database.java 2014/09/11 08:14:40 2200 +++ dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/Database.java 2014/09/11 16:42:08 2207 @@ -94,15 +94,20 @@ public List hentPostnumre() throws SQLException { ArrayList list = new ArrayList(); + + Constants consts = Constants.getInstance(); String sql = "SELECT postnr " + "FROM fulddaekning.adressetabel " + - "WHERE distributor = ? and rute is not null " + + //"WHERE distributor = ? and rute is not null " + + "WHERE postnr BETWEEN ? AND ? " + "GROUP BY postnr " + "ORDER by postnr"; PreparedStatement stmt = conn.prepareStatement(sql); - stmt.setString(1, Lookup.distributor ); + //stmt.setString(1, Lookup.distributor ); + stmt.setInt(1, consts.getMinPostnr()); + stmt.setInt(2, consts.getMaxPostnr()); ResultSet res = stmt.executeQuery(); while (res.next()) { @@ -117,7 +122,7 @@ return list; } - public ArrayList hentDaekkedeAdresser( BoundingBox bbox) throws SQLException { + public Adresse[] hentDaekkedeAdresser( BoundingBox bbox) throws SQLException { String sql = "SELECT id,postnr,adresse,gadeid,husnr,husnrbogstav,latitude,longitude,rute " + "FROM fulddaekning.adressetabel " + "WHERE rute IS NOT NULL " + @@ -137,7 +142,8 @@ stmt.setDouble(4, bbox.longitudeMax); stmt.setString(5, Lookup.distributor); - return hentAdresseListe( stmt ); + List list = hentAdresseListe( stmt ); + return list.toArray( new Adresse[ list.size() ] ); }