/[projects]/dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/Database.java
ViewVC logotype

Diff of /dao/FuldDaekningWorker/src/dk/daoas/fulddaekning/Database.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2239 by torben, Tue Dec 9 20:39:45 2014 UTC revision 2240 by torben, Wed Dec 10 08:26:12 2014 UTC
# Line 59  public class Database { Line 59  public class Database {
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  " +
# Line 87  public class Database { Line 87  public class Database {
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    
# Line 124  public class Database { Line 124  public class Database {
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                                    
# Line 135  public class Database { Line 136  public class Database {
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()) {

Legend:
Removed from v.2239  
changed lines
  Added in v.2240

  ViewVC Help
Powered by ViewVC 1.1.20