diff --git a/src/osm/jp/coverage/busstop/DbBusstop.java b/src/osm/jp/coverage/busstop/DbBusstop.java index f4a0971..e84f3c8 100644 --- a/src/osm/jp/coverage/busstop/DbBusstop.java +++ b/src/osm/jp/coverage/busstop/DbBusstop.java @@ -197,7 +197,7 @@ } } - try (PreparedStatement ps6 = con.prepareStatement("UPDATE bus_stop SET lat=?,lon=?,fixed=? WHERE idref=?")) { + try (PreparedStatement ps6 = con.prepareStatement("UPDATE bus_stop SET lat=?,lon=?,fixed=? WHERE gmlid=?")) { double lat = Double.parseDouble(latStr); double lon = Double.parseDouble(lonStr); ps6.setDouble(1, lat); @@ -248,10 +248,10 @@ latStr = str4Ary[0]; lonStr = str4Ary[1]; - try (PreparedStatement ps6 = con.prepareStatement("INSERT INTO bus_stop (lat,lon,fixed, area,idref) VALUES (?,?,?,?,?)")) { + try (PreparedStatement ps6 = con.prepareStatement("INSERT INTO bus_stop (lat,lon,fixed, area,gmlid) VALUES (?,?,?,?,?)")) { double lat = Double.parseDouble(latStr); double lon = Double.parseDouble(lonStr); - System.out.println("INSERT INTO bus_stop (lat,lon,fixed,area, idref) VALUES ('"+ latStr +"','"+ lonStr +"','0',"+ areacode +",'"+ idStr +"')"); + System.out.println("INSERT INTO bus_stop (lat,lon,fixed,area, gmlid) VALUES ('"+ latStr +"','"+ lonStr +"','0',"+ areacode +",'"+ idStr +"')"); ps6.setDouble(1, lat); ps6.setDouble(2, lon); @@ -274,10 +274,10 @@ */ /* public static void showED01(Connection con, Node node, String iFileName) throws IOException, SQLException { - String idrefStr = ""; + String gmlidStr = ""; String nameStr = ""; - PreparedStatement ps1 = con.prepareStatement("SELECT idref FROM bus_stop WHERE idref=?"); - PreparedStatement ps2 = con.prepareStatement("INSERT INTO bus_stop (idref,name,ifile) VALUES (?,?,?)"); + PreparedStatement ps1 = con.prepareStatement("SELECT gmlid FROM bus_stop WHERE gmlid=?"); + PreparedStatement ps2 = con.prepareStatement("INSERT INTO bus_stop (gmlid,name,ifile) VALUES (?,?,?)"); try { ArrayList bris = new ArrayList<>(); NodeList nodes = node.getChildNodes(); @@ -288,9 +288,9 @@ NamedNodeMap nodeMap = node2.getAttributes(); if (null != nodeMap) { for ( int j=0; j < nodeMap.getLength(); j++ ) { - if (nodeMap.item(j).getNodeName().equals("idref")) { - idrefStr = nodeMap.item(j).getNodeValue(); - System.out.println("found idref='"+ idrefStr +"'"); + if (nodeMap.item(j).getNodeName().equals("gmlid")) { + gmlidStr = nodeMap.item(j).getNodeValue(); + System.out.println("found gmlid='"+ gmlidStr +"'"); break; } } @@ -308,9 +308,9 @@ } } - // idref と nameStr をデータベースに格納する + // gmlid と nameStr をデータベースに格納する boolean insert = true; - ps1.setString(1, idrefStr); + ps1.setString(1, gmlidStr); try (ResultSet rset = ps1.executeQuery()) { if (rset.next()) { insert = false; @@ -318,10 +318,10 @@ } if (insert) { - ps2.setString(1, idrefStr); + ps2.setString(1, gmlidStr); ps2.setString(2, nameStr); ps2.setString(3, iFileName); - System.out.println("INSERT INTO bus_stop (idref,name,ifile) VALUES ('"+ idrefStr +"','"+ nameStr +"','"+ iFileName +"')"); + System.out.println("INSERT INTO bus_stop (gmlid,name,ifile) VALUES ('"+ gmlidStr +"','"+ nameStr +"','"+ iFileName +"')"); ps2.executeUpdate(); } } @@ -366,9 +366,9 @@ * @throws SQLException */ public static void showBusStop(Connection con, Node node, String iFileName) throws IOException, SQLException { - String idrefStr = ""; + String gmlidStr = ""; String nameStr = ""; - try (PreparedStatement ps2 = con.prepareStatement("UPDATE bus_stop SET name=?,ifile=? WHERE idref=?")) { + try (PreparedStatement ps2 = con.prepareStatement("UPDATE bus_stop SET name=?,ifile=? WHERE gmlid=?")) { ArrayList bris = new ArrayList<>(); NodeList nodes = node.getChildNodes(); for (int i=0; i < nodes.getLength(); i++) { @@ -379,9 +379,9 @@ if (null != nodeMap) { for ( int j=0; j < nodeMap.getLength(); j++ ) { if (nodeMap.item(j).getNodeName().equals("xlink:href")) { - idrefStr = nodeMap.item(j).getNodeValue(); - idrefStr = idrefStr.substring(1); - System.out.println("found idref='"+ idrefStr +"'"); + gmlidStr = nodeMap.item(j).getNodeValue(); + gmlidStr = gmlidStr.substring(1); + System.out.println("found gmlid='"+ gmlidStr +"'"); break; } } @@ -399,10 +399,10 @@ } } - // idref と nameStr をデータベースに格納する + // gmlid と nameStr をデータベースに格納する ps2.setString(1, nameStr); ps2.setString(2, iFileName); - ps2.setString(3, idrefStr); + ps2.setString(3, gmlidStr); ps2.executeUpdate(); } } @@ -493,10 +493,10 @@ String createSt; // 'table.BUS_STOP'を新規に作る - createSt = "CREATE TABLE bus_stop (idref VARCHAR(12) NOT NULL, gid LONG, name VARCHAR(128), kana VARCHAR(128), lat DOUBLE, lon DOUBLE, fixed INT, fixed1 INT, area INT, ifile VARCHAR(128), up INT, CONSTRAINT bus_stop_pk PRIMARY KEY(idref));"; + createSt = "CREATE TABLE bus_stop (gmlid VARCHAR(12) NOT NULL, gid LONG, name VARCHAR(128), kana VARCHAR(128), lat DOUBLE, lon DOUBLE, fixed INT, fixed1 INT, area INT, ifile VARCHAR(128), up INT, CONSTRAINT bus_stop_pk PRIMARY KEY(gmlid));"; create(conHsql, createSt); - //createSt = "CREATE TABLE existing_data (idref VARCHAR(12) NOT NULL, name VARCHAR(128), lat DOUBLE, lon DOUBLE, score INT, CONSTRAINT existing_pk PRIMARY KEY(idref, lat, lon));"; + //createSt = "CREATE TABLE existing_data (gmlid VARCHAR(12) NOT NULL, name VARCHAR(128), lat DOUBLE, lon DOUBLE, score INT, CONSTRAINT existing_pk PRIMARY KEY(gmlid, lat, lon));"; //create(conHsql, createSt); //createSt = "CREATE TABLE coverage (area INT, name VARCHAR(128), denominator BIGINT, lv1 BIGINT, lv2 BIGINT, lv3 BIGINT);";