diff --git a/table.cpp b/table.cpp index 920c3720c..d3d0e17ae 100644 --- a/table.cpp +++ b/table.cpp @@ -47,6 +47,7 @@ table_t::table_t(table_t const &other, // this would be premature. if (other.sql_conn) { connect(); + prepare(); } } @@ -171,6 +172,11 @@ void table_t::start(std::string const &conninfo, //TODO: change the type of the geometry column if needed - this can only change to a more permissive type } + prepare(); +} + +void table_t::prepare() +{ //let postgres cache this query as it will presumably happen a lot pgsql_exec_simple(sql_conn, PGRES_COMMAND_OK, (fmt("PREPARE get_wkb (" POSTGRES_OSMID_TYPE diff --git a/table.hpp b/table.hpp index a08264b91..b656ddc95 100644 --- a/table.hpp +++ b/table.hpp @@ -71,6 +71,7 @@ class table_t protected: void connect(); + void prepare(); void teardown(); void write_columns(taglist_t const &tags, std::vector *used);