/[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 2328 by torben, Thu Feb 19 13:39:33 2015 UTC revision 2424 by torben, Tue Mar 3 08:52:39 2015 UTC
# Line 144  public class Database { Line 144  public class Database {
144                                    
145                  return new ConcurrentLinkedQueue<Adresse>(postListe);                            return new ConcurrentLinkedQueue<Adresse>(postListe);          
146          }          }
   
147                    
148          public Adresse[] hentDaekkedeAdresserCache( BoundingBox bbox) {          public Adresse[] hentDaekkedeAdresserCache( BoundingBox bbox, Adresse adresseListe[] ) {
149                  long start = System.currentTimeMillis();                  long start = System.currentTimeMillis();
150                  ArrayList<Adresse> list = new ArrayList<Adresse>();                  ArrayList<Adresse> list = new ArrayList<Adresse>();
151                  for (Adresse a : alleAdresser) {                  for (Adresse a : adresseListe) {
152                          if ( a.latitude > bbox.latitudeMin && a.latitude< bbox.latitudeMax && a.longitude> bbox.longitudeMin && a.longitude < bbox.longitudeMax) {                          if ( a.latitude > bbox.latitudeMin && a.latitude< bbox.latitudeMax && a.longitude> bbox.longitudeMin && a.longitude < bbox.longitudeMax) {
153                                  list.add(a);                                  list.add(a);
154                          }                          }
# Line 158  public class Database { Line 157  public class Database {
157                  logger.info("Elapsed cache: " + (stop - start));                  logger.info("Elapsed cache: " + (stop - start));
158                  return list.toArray( new Adresse[ list.size() ] );                                return list.toArray( new Adresse[ list.size() ] );              
159          }          }
160    
161            
162            public Adresse[] hentDaekkedeAdresserCache( BoundingBox bbox) {
163                    return hentDaekkedeAdresserCache(bbox, alleAdresser);  
164            }
165            
166            
167                    
168                    
169          public Adresse[] hentAlleDaekkedeAdresser() throws SQLException {          public Adresse[] hentAlleDaekkedeAdresser() throws SQLException {
# Line 172  public class Database { Line 178  public class Database {
178                    
179                          // Forward only + concur_read_only + fetchsize tvinger driver til at hente en række af gangen (bedre performance ved store result sets)                          // Forward only + concur_read_only + fetchsize tvinger driver til at hente en række af gangen (bedre performance ved store result sets)
180                          // Se http://dev.mysql.com/doc/connector-j/en/connector-j-reference-implementation-notes.html                          // Se http://dev.mysql.com/doc/connector-j/en/connector-j-reference-implementation-notes.html
                         //PreparedStatement stmt = conn.prepareStatement(sql);  
181                          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);
182                          stmt.setFetchSize(Integer.MIN_VALUE);                          stmt.setFetchSize(Integer.MIN_VALUE);
183                    
# Line 217  public class Database { Line 222  public class Database {
222    
223                  saveStmt.addBatch();                  saveStmt.addBatch();
224                  batchCount++;                  batchCount++;
225                  if (batchCount >= 100) {                  if (batchCount >= 1000) {
226                          saveStmt.executeBatch();                          saveStmt.executeBatch();
227                          batchCount = 0;                          batchCount = 0;
228                  }                  }
# Line 305  public class Database { Line 310  public class Database {
310    
311                    
312          // //////////////////////////////////////////////////////////////////          // //////////////////////////////////////////////////////////////////
313                    /*
314          @Deprecated          @Deprecated
315          private BoundingBox getBoundingboxFromDb_old(String postnr) throws SQLException {          private BoundingBox getBoundingboxFromDb_old(String postnr) throws SQLException {
316                  String minPostnr = postnr.replace('x', '0');                  String minPostnr = postnr.replace('x', '0');
# Line 401  public class Database { Line 406  public class Database {
406                                           "AND rute is null " + // Træk kun liste på postnumre hvor der er ikke-dækkede adresser                                           "AND rute is null " + // Træk kun liste på postnumre hvor der er ikke-dækkede adresser
407                                           "GROUP BY postnr " +                                           "GROUP BY postnr " +
408                                           "ORDER by postnr";                                           "ORDER by postnr";
409                  */                  * /
410                                    
411                                    
412                  String sql = "SELECT rpad(left(postnr,?),'4', 'x') as postnr2 " +                  String sql = "SELECT rpad(left(postnr,?),'4', 'x') as postnr2 " +
# Line 433  public class Database { Line 438  public class Database {
438                  //list.add(8700);                  //list.add(8700);
439    
440                  return list;                  return list;
441          }          }*/
442    
443                    
444  }  }

Legend:
Removed from v.2328  
changed lines
  Added in v.2424

  ViewVC Help
Powered by ViewVC 1.1.20