Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #4 from tomhughes/master

Changes for rails 3
  • Loading branch information...
commit 04bd7bb23f4843715d3ebfb7d4f0ac2ec02b2a9f 2 parents 4c0e87d + 2e7733c
@zerebubuth authored
Showing with 15 additions and 15 deletions.
  1. +6 −6 src/map.cpp
  2. +9 −9 src/temp_tables.cpp
View
12 src/map.cpp
@@ -60,7 +60,7 @@ map_writer::write_node(const pqxx::result::tuple &r) {
writer.attribute("changeset", cs_id);
writer.attribute("timestamp", r["timestamp"].c_str());
- pqxx::result tags = w.exec("select k, v from current_node_tags where id=" + pqxx::to_string(id));
+ pqxx::result tags = w.exec("select k, v from current_node_tags where node_id=" + pqxx::to_string(id));
for (pqxx::result::const_iterator itr = tags.begin();
itr != tags.end(); ++itr) {
writer.start("tag");
@@ -88,7 +88,7 @@ map_writer::write_way(const pqxx::result::tuple &r) {
writer.attribute("changeset", cs_id);
writer.attribute("timestamp", r["timestamp"].c_str());
- pqxx::result nodes = w.exec("select node_id from current_way_nodes where id=" +
+ pqxx::result nodes = w.exec("select node_id from current_way_nodes where way_id=" +
pqxx::to_string(id) + " order by sequence_id asc");
for (pqxx::result::const_iterator itr = nodes.begin();
itr != nodes.end(); ++itr) {
@@ -97,7 +97,7 @@ map_writer::write_way(const pqxx::result::tuple &r) {
writer.end();
}
- pqxx::result tags = w.exec("select k, v from current_way_tags where id=" + pqxx::to_string(id));
+ pqxx::result tags = w.exec("select k, v from current_way_tags where way_id=" + pqxx::to_string(id));
for (pqxx::result::const_iterator itr = tags.begin();
itr != tags.end(); ++itr) {
writer.start("tag");
@@ -126,7 +126,7 @@ map_writer::write_relation(const pqxx::result::tuple &r) {
writer.attribute("timestamp", r["timestamp"].c_str());
pqxx::result members = w.exec("select member_type, member_id, member_role from "
- "current_relation_members where id=" +
+ "current_relation_members where relation_id=" +
pqxx::to_string(id) + " order by sequence_id asc");
for (pqxx::result::const_iterator itr = members.begin();
itr != members.end(); ++itr) {
@@ -139,7 +139,7 @@ map_writer::write_relation(const pqxx::result::tuple &r) {
writer.end();
}
- pqxx::result tags = w.exec("select k, v from current_relation_tags where id=" + pqxx::to_string(id));
+ pqxx::result tags = w.exec("select k, v from current_relation_tags where relation_id=" + pqxx::to_string(id));
for (pqxx::result::const_iterator itr = tags.begin();
itr != tags.end(); ++itr) {
writer.start("tag");
@@ -160,7 +160,7 @@ map_writer::write() {
"to_char(n.timestamp,'YYYY-MM-DD\"T\"HH24:MI:SS\"Z\"') as timestamp, "
"n.changeset_id, n.version from current_nodes n join ("
"select id from tmp_nodes union distinct select wn.node_id "
- "from tmp_ways w join current_way_nodes wn on w.id = wn.id) x "
+ "from tmp_ways w join current_way_nodes wn on w.id = wn.way_id) x "
"on n.id = x.id");
for (pqxx::result::const_iterator itr = nodes.begin();
itr != nodes.end(); ++itr) {
View
18 src/temp_tables.cpp
@@ -72,7 +72,7 @@ tmp_ways::tmp_ways(pqxx::work &w)
logger::message("Creating tmp_ways");
work.exec("create temporary table tmp_ways as "
- "select distinct wn.id from current_way_nodes wn "
+ "select distinct wn.way_id as id from current_way_nodes wn "
"join tmp_nodes tn on wn.node_id = tn.id");
work.exec("create index tmp_ways_idx on tmp_ways(id)");
}
@@ -86,17 +86,17 @@ tmp_relations::tmp_relations(pqxx::work &w)
logger::message("Creating tmp_relations");
work.exec("create temporary table tmp_relations as "
- "select distinct id from current_relation_members rm where rm.member_type='Way' "
+ "select distinct relation_id as id from current_relation_members rm where rm.member_type='Way' "
"and rm.member_id in (select id from tmp_ways)");
work.exec("create index tmp_relations_idx on tmp_relations(id)");
- work.exec("insert into tmp_relations select distinct rm.id from current_relation_members rm "
+ work.exec("insert into tmp_relations select distinct rm.relation_id as id from current_relation_members rm "
"where rm.member_type='Node' and rm.member_id in (select n.id from tmp_nodes n) "
- "and rm.id not in (select id from tmp_relations)");
- work.exec("insert into tmp_relations select distinct id from current_relation_members rm "
+ "and rm.relation_id not in (select id from tmp_relations)");
+ work.exec("insert into tmp_relations select distinct relation_id as id from current_relation_members rm "
"where rm.member_type='Node' and rm.member_id in (select distinct "
- "node_id from current_way_nodes where id in (select id from tmp_ways)) "
- "and id not in (select id from tmp_relations)");
- work.exec("insert into tmp_relations select distinct id from current_relation_members rm "
+ "node_id from current_way_nodes where way_id in (select id from tmp_ways)) "
+ "and relation_id not in (select id from tmp_relations)");
+ work.exec("insert into tmp_relations select distinct relation_id as id from current_relation_members rm "
"where rm.member_type='Relation' and rm.member_id in (select id from tmp_relations) "
- "and id not in (select id from tmp_relations)");
+ "and relation_id not in (select id from tmp_relations)");
}
Please sign in to comment.
Something went wrong with that request. Please try again.