Skip to content

Commit f9d8093

Browse files
committed
Move get_ids() helper function from middle into pgsql-helper.cpp
1 parent 23726b4 commit f9d8093

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/middle-pgsql.cpp

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -386,25 +386,19 @@ void middle_pgsql_t::node_delete(osmid_t osm_id)
386386
}
387387
}
388388

389-
idlist_t middle_pgsql_t::get_ids(const char* stmt, osmid_t osm_id)
390-
{
391-
auto const res = m_db_connection.exec_prepared(stmt, osm_id);
392-
return get_ids_from_result(res);
393-
}
394-
395389
idlist_t middle_pgsql_t::get_ways_by_node(osmid_t osm_id)
396390
{
397-
return get_ids("mark_ways_by_node", osm_id);
391+
return get_ids_from_db(&m_db_connection, "mark_ways_by_node", osm_id);
398392
}
399393

400394
idlist_t middle_pgsql_t::get_rels_by_node(osmid_t osm_id)
401395
{
402-
return get_ids("mark_rels_by_node", osm_id);
396+
return get_ids_from_db(&m_db_connection, "mark_rels_by_node", osm_id);
403397
}
404398

405399
idlist_t middle_pgsql_t::get_rels_by_way(osmid_t osm_id)
406400
{
407-
return get_ids("mark_rels_by_way", osm_id);
401+
return get_ids_from_db(&m_db_connection, "mark_rels_by_way", osm_id);
408402
}
409403

410404
void middle_pgsql_t::way_set(osmium::Way const &way)

src/middle-pgsql.hpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,8 +128,6 @@ struct middle_pgsql_t : public middle_t
128128

129129
void buffer_store_tags(osmium::OSMObject const &obj, bool attrs);
130130

131-
idlist_t get_ids(const char* stmt, osmid_t osm_id);
132-
133131
table_desc m_tables[NUM_TABLES];
134132

135133
options_t const *m_options;

src/pgsql-helper.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ idlist_t get_ids_from_result(pg_result_t const &result) {
1313
return ids;
1414
}
1515

16+
idlist_t get_ids_from_db(pg_conn_t const *db_connection, char const *stmt,
17+
osmid_t id)
18+
{
19+
auto const res = db_connection->exec_prepared(stmt, id);
20+
return get_ids_from_result(res);
21+
}
22+
1623
void create_geom_check_trigger(pg_conn_t *db_connection,
1724
std::string const &schema,
1825
std::string const &table,

src/pgsql-helper.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
*/
1515
idlist_t get_ids_from_result(pg_result_t const &result);
1616

17+
idlist_t get_ids_from_db(pg_conn_t const *db_connection, char const *stmt,
18+
osmid_t id);
19+
1720
void create_geom_check_trigger(pg_conn_t *db_connection,
1821
std::string const &schema,
1922
std::string const &table,

0 commit comments

Comments
 (0)