--- dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/Database.java 2014/12/10 07:36:40 2239 +++ dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/Database.java 2014/12/10 08:26:12 2240 @@ -59,8 +59,8 @@ } public BoundingBox getBoundingbox(String postnr) throws SQLException { - String minPostnr = postnr.replace("x", "0"); - String maxPostnr = postnr.replace("x", "9"); + String minPostnr = postnr.replace('x', '0'); + String maxPostnr = postnr.replace('x', '9'); String sql = "SELECT max(latitude) latmax, min(latitude) latmin, max(longitude) lngmax,min(longitude) lngmin " + @@ -87,8 +87,8 @@ public Queue hentIkkedaekkedeAdresser(String postnr) throws SQLException { - String minPostnr = postnr.replace("x", "0"); - String maxPostnr = postnr.replace("x", "9"); + String minPostnr = postnr.replace('x', '0'); + String maxPostnr = postnr.replace('x', '9'); ConcurrentLinkedQueue queue = new ConcurrentLinkedQueue(); @@ -124,10 +124,11 @@ */ - String sql = "SELECT concat(left(postnr,3),'x') as postnr2 " + + String sql = "SELECT rpad(left(postnr,?),'4', 'x') as postnr2 " + "FROM fulddaekning.adressetabel " + "WHERE postnr BETWEEN ? AND ? " + - "AND rute is null " + // Træk kun liste på postnumre hvor der er ikke-dækkede adresser + "AND rute is null " + // Trae kun liste paa postnumre hvor der er ikke-daekede adresser + "AND (postnr NOT BETWEEN 3900 and 3999) " + //Skip alle groenlandske postnumre "GROUP BY postnr2 " + "ORDER by postnr2 "; @@ -135,8 +136,11 @@ PreparedStatement stmt = conn.prepareStatement(sql); //stmt.setString(1, Lookup.distributor ); - stmt.setInt(1, consts.getMinPostnr()); - stmt.setInt(2, consts.getMaxPostnr()); + + stmt.setInt(1, consts.getPostnrGroup() ); + + stmt.setInt(2, consts.getMinPostnr()); + stmt.setInt(3, consts.getMaxPostnr()); ResultSet res = stmt.executeQuery(); while (res.next()) {