From 78a6c75de7743443c40d56be61ea0dd4265bd401 Mon Sep 17 00:00:00 2001 From: Sarah Hoffmann Date: Wed, 17 Apr 2019 21:57:21 +0200 Subject: [PATCH] prepare get_wkb on copy connections as well Fixes #924. --- table.cpp | 6 ++++++ table.hpp | 1 + 2 files changed, 7 insertions(+) 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);