| |
---|
| | |
---|
| | public static void transportUpdate (Connection conHsql, Connection conPost) throws FileNotFoundException, ClassNotFoundException, SQLException, IOException, ParserConfigurationException, SAXException { |
---|
| | toInsert(conHsql, conPost); |
---|
| | |
---|
| | try ( PreparedStatement ps1 = conHsql.prepareStatement("SELECT gid,fixed1 FROM FUEL where up=1"); |
---|
| | PreparedStatement ps2 = conPost.prepareStatement("UPDATE t_FUEL set fixed=? WHERE gid=?")) { |
---|
| | try ( PreparedStatement ps1 = conHsql.prepareStatement("SELECT gmlid,area,fixed1 FROM FUEL where up=1"); |
---|
| | PreparedStatement ps2 = conPost.prepareStatement("UPDATE t_FUEL set fixed=? WHERE gmlid=? AND area=?")) { |
---|
| | try (ResultSet rset1 = ps1.executeQuery()) { |
---|
| | while (rset1.next()) { |
---|
| | long gid = rset1.getLong("gid"); |
---|
| | String gmlid = rset1.getString("gmlid"); |
---|
| | int area = rset1.getInt("area"); |
---|
| | int fixed1 = rset1.getInt("fixed1"); |
---|
| | ps2.setInt(1, fixed1); |
---|
| | ps2.setLong(2, gid); |
---|
| | System.out.println("UPDATE t_FUEL set fixed="+ fixed1 +" WHERE gid="+ gid); |
---|
| | ps2.setString(2, gmlid); |
---|
| | ps2.setInt(3, area); |
---|
| | System.out.println("UPDATE t_FUEL set fixed="+ fixed1 +" WHERE gmlid="+ gmlid +" AND area="+ area); |
---|
| | ps2.executeUpdate(); |
---|
| | } |
---|
| | } |
---|
| | } |
---|
| |
---|
| | int fixed1 = rset1.getInt("fixed1"); |
---|
| | double lat = rset1.getDouble("lat"); |
---|
| | double lon = rset1.getDouble("lon"); |
---|
| | |
---|
| | String sqlStr = "INSERT INTO t_FUEL (idref,fixed,area,geom) VALUES ('"+ gmlid +"',"+ fixed1 +","+ area +",ST_GeomFromText('POINT("+ BigDecimal.valueOf(lon).toPlainString() +" "+ BigDecimal.valueOf(lat).toPlainString() +")', 4612))"; |
---|
| | String sqlStr = "INSERT INTO t_FUEL (gmlid,fixed,area,geom) VALUES ('"+ gmlid +"',"+ fixed1 +","+ area +",ST_GeomFromText('POINT("+ BigDecimal.valueOf(lon).toPlainString() +" "+ BigDecimal.valueOf(lat).toPlainString() +")', 4612))"; |
---|
| | try (PreparedStatement ps = conPost.prepareStatement(sqlStr)) { |
---|
| | System.out.println(sqlStr); |
---|
| | ps.executeUpdate(); |
---|
| | } |
---|
| |
---|
| | |