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()) { |
174 |
stmt.setDouble(2, bbox.latitudeMax); |
stmt.setDouble(2, bbox.latitudeMax); |
175 |
stmt.setDouble(3, bbox.longitudeMin); |
stmt.setDouble(3, bbox.longitudeMin); |
176 |
stmt.setDouble(4, bbox.longitudeMax); |
stmt.setDouble(4, bbox.longitudeMax); |
177 |
stmt.setString(5, Lookup.distributor); |
stmt.setString(5, LookupMain.distributor); |
178 |
|
|
179 |
List<Adresse> list = hentAdresseListe( stmt ); |
List<Adresse> list = hentAdresseListe( stmt ); |
180 |
return list.toArray( new Adresse[ list.size() ] ); |
return list.toArray( new Adresse[ list.size() ] ); |
196 |
PreparedStatement stmt = conn.prepareStatement(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); |
PreparedStatement stmt = conn.prepareStatement(sql, java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); |
197 |
stmt.setFetchSize(Integer.MIN_VALUE); |
stmt.setFetchSize(Integer.MIN_VALUE); |
198 |
|
|
199 |
stmt.setString(1, Lookup.distributor); |
stmt.setString(1, LookupMain.distributor); |
200 |
|
|
201 |
List<Adresse> list = hentAdresseListe( stmt ); |
List<Adresse> list = hentAdresseListe( stmt ); |
202 |
return list.toArray( new Adresse[ list.size() ] ); |
return list.toArray( new Adresse[ list.size() ] ); |