59 |
} |
} |
60 |
|
|
61 |
public BoundingBox getBoundingbox(String postnr) throws SQLException { |
public BoundingBox getBoundingbox(String postnr) throws SQLException { |
62 |
String minPostnr = postnr.replace("x", "0"); |
String minPostnr = postnr.replace('x', '0'); |
63 |
String maxPostnr = postnr.replace("x", "9"); |
String maxPostnr = postnr.replace('x', '9'); |
64 |
|
|
65 |
String sql = |
String sql = |
66 |
"SELECT max(latitude) latmax, min(latitude) latmin, max(longitude) lngmax,min(longitude) lngmin " + |
"SELECT max(latitude) latmax, min(latitude) latmin, max(longitude) lngmax,min(longitude) lngmin " + |
87 |
|
|
88 |
public Queue<Adresse> hentIkkedaekkedeAdresser(String postnr) throws SQLException { |
public Queue<Adresse> hentIkkedaekkedeAdresser(String postnr) throws SQLException { |
89 |
|
|
90 |
String minPostnr = postnr.replace("x", "0"); |
String minPostnr = postnr.replace('x', '0'); |
91 |
String maxPostnr = postnr.replace("x", "9"); |
String maxPostnr = postnr.replace('x', '9'); |
92 |
|
|
93 |
ConcurrentLinkedQueue<Adresse> queue = new ConcurrentLinkedQueue<Adresse>(); |
ConcurrentLinkedQueue<Adresse> queue = new ConcurrentLinkedQueue<Adresse>(); |
94 |
|
|
124 |
*/ |
*/ |
125 |
|
|
126 |
|
|
127 |
String sql = "SELECT concat(left(postnr,3),'x') as postnr2 " + |
String sql = "SELECT rpad(left(postnr,?),'4', 'x') as postnr2 " + |
128 |
"FROM fulddaekning.adressetabel " + |
"FROM fulddaekning.adressetabel " + |
129 |
"WHERE postnr BETWEEN ? AND ? " + |
"WHERE postnr BETWEEN ? AND ? " + |
130 |
"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 |
131 |
|
"AND (postnr NOT BETWEEN 3900 and 3999) " + //Skip alle groenlandske postnumre |
132 |
"GROUP BY postnr2 " + |
"GROUP BY postnr2 " + |
133 |
"ORDER by postnr2 "; |
"ORDER by postnr2 "; |
134 |
|
|
136 |
|
|
137 |
PreparedStatement stmt = conn.prepareStatement(sql); |
PreparedStatement stmt = conn.prepareStatement(sql); |
138 |
//stmt.setString(1, Lookup.distributor ); |
//stmt.setString(1, Lookup.distributor ); |
139 |
stmt.setInt(1, consts.getMinPostnr()); |
|
140 |
stmt.setInt(2, consts.getMaxPostnr()); |
stmt.setInt(1, consts.getPostnrGroup() ); |
141 |
|
|
142 |
|
stmt.setInt(2, consts.getMinPostnr()); |
143 |
|
stmt.setInt(3, consts.getMaxPostnr()); |
144 |
ResultSet res = stmt.executeQuery(); |
ResultSet res = stmt.executeQuery(); |
145 |
|
|
146 |
while (res.next()) { |
while (res.next()) { |