• R/O
  • HTTP
  • SSH
  • HTTPS

convbusstop: Commit


Commit MetaInfo

Revisión2242bf762814c10a6b21b064a5761bb27abdaee3 (tree)
Tiempo2017-01-15 09:14:14
Autoryuuhayashi <hayashi.yuu@gmai...>
Commiteryuuhayashi

Log Message

postgresql 用に(')をエスケープする

Cambiar Resumen

Diferencia incremental

--- a/src/osm/jp/ConvBusstop.java
+++ b/src/osm/jp/ConvBusstop.java
@@ -1248,7 +1248,7 @@ public class ConvBusstop {
12481248 }
12491249
12501250 /**
1251- * OSMデータファイルかどうかを見極める
1251+ * 数値地図情報のデータファイルかどうかを見極める
12521252 * @param f
12531253 * @return
12541254 */
--- a/src/osm/jp/ToPostgis.java
+++ b/src/osm/jp/ToPostgis.java
@@ -48,7 +48,7 @@ public class ToPostgis {
4848 int areacode = rset8.getInt("area");
4949
5050 counter++;
51- String osm_node = "insert into t_busstop(name,fixed,area,geom) VALUES('"+ name +"',"+ fixed +","+ areacode +", ST_GeomFromText('POINT("+ Double.toString(lon) +" "+ Double.toString(lat) +")', 4612));";
51+ String osm_node = "insert into t_busstop(name,fixed,area,geom) VALUES('"+ escapeStr(name) +"',"+ fixed +","+ areacode +", ST_GeomFromText('POINT("+ Double.toString(lon) +" "+ Double.toString(lat) +")', 4612));";
5252 System.out.println(osm_node);
5353 this.ow.write(osm_node);
5454 this.ow.newLine();
@@ -58,6 +58,16 @@ public class ToPostgis {
5858 return counter;
5959 }
6060
61+ /**
62+ * postgresql 用に(')をエスケープする
63+ *
64+ * @param name
65+ * @return
66+ */
67+ public String escapeStr(String name) {
68+ return name.replaceAll("'", "''");
69+ }
70+
6171 public void close() {
6272 try {
6373 this.ow.close();
Show on old repository browser