/[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 2191 by torben, Sat May 10 08:24:55 2014 UTC revision 2192 by torben, Thu Jun 19 10:24:16 2014 UTC
# Line 24  public class Database { Line 24  public class Database {
24          public Database(SafeProperties conf)  throws SQLException,IOException {          public Database(SafeProperties conf)  throws SQLException,IOException {
25                  this.conn = getConnection( conf );                        this.conn = getConnection( conf );      
26    
27                  String sql = "INSERT INTO fulddaekning.afstand_anden_rute_thn (orgId,orgPostnr, orgAdresse,orgGadeid,orgHusnr,orgHusnrBogstav,orgLatitude,orgLongitude,orgRute,id,postnr,adresse,gadeid,husnr,husnrbogstav,latitude,longitude,rute,afstand,`timestamp`) "+                  String sql = "INSERT INTO fulddaekning.afstand_anden_rute_ny (orgId,orgPostnr, orgAdresse,orgGadeid,orgHusnr,orgHusnrBogstav,orgLatitude,orgLongitude,orgRute,id,postnr,adresse,gadeid,husnr,husnrbogstav,latitude,longitude,rute,afstand,`timestamp`) "+
28                                  "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, now() )";                                  "VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, now() )";
29    
30                  saveStmt = conn.prepareStatement(sql);                            saveStmt = conn.prepareStatement(sql);          
# Line 32  public class Database { Line 32  public class Database {
32          }          }
33    
34          public void resetResultTable() throws SQLException {          public void resetResultTable() throws SQLException {
35                  logger.info("Truncating result table");                  logger.info("Dropping old result table (if exists)");
36                  String sql = "TRUNCATE TABLE fulddaekning.afstand_anden_rute_thn";                  String sql = "DROP TABLE IF EXISTS fulddaekning.afstand_anden_rute_ny";
37                  conn.createStatement().executeUpdate(sql);                  conn.createStatement().executeUpdate(sql);
38                    
39                    logger.info("Create new result table");
40                    sql = "CREATE TABLE fulddaekning.afstand_anden_rute_ny LIKE fulddaekning.afstand_anden_rute";
41                    conn.createStatement().executeUpdate(sql);              
42            }      
43            
44            public void renameResultTables() throws SQLException {
45                    logger.info("Dropping old backup table (if exists)");
46                    String sql = "DROP TABLE IF EXISTS fulddaekning.afstand_anden_rute_old";
47                    conn.createStatement().executeUpdate(sql);
48                    
49                    logger.info("Rename tables");
50                    sql = "RENAME TABLE fulddaekning.afstand_anden_rute TO fulddaekning.afstand_anden_rute_old, fulddaekning.afstand_anden_rute_ny TO fulddaekning.afstand_anden_rute";
51                    conn.createStatement().executeUpdate(sql);              
52          }                }      
53    
54          public BoundingBox getBoundingbox(int postnr) throws SQLException {          public BoundingBox getBoundingbox(int postnr) throws SQLException {

Legend:
Removed from v.2191  
changed lines
  Added in v.2192

  ViewVC Help
Powered by ViewVC 1.1.20