[Tile-serving] [openstreetmap/osm2pgsql] Introduce separate COPY threads (#914)

Paul Norman notifications at github.com
Mon Feb 25 23:51:36 UTC 2019


pnorman commented on this pull request.

This looks good, but it makes me realize that my C++ is clearly rusty.

What testing can I help with?

> +    void add_array_elem(char const *s)
+    {
+        assert(m_current);
+        m_current->buffer += '"';
+        add_escaped_string(s);
+        m_current->buffer += "\",";
+    }
+
+    /// Finish an array column.
+    void finish_array()
+    {
+        auto idx = m_current->buffer.size() - 1;
+        if (m_current->buffer[idx] == '{')
+            m_current->buffer += '}';
+        else
+            m_current->buffer[idx] = '}';

A comment about how this is overwriting a `,` would be good here.

> @@ -245,20 +156,34 @@ pg_result_t middle_query_pgsql_t::exec_prepared(char const *stmt,
     return exec_prepared(stmt, buffer);
 }
 
+pg_result_t middle_pgsql_t::exec_prepared(char const *stmt, osmid_t osm_id) const
+{
+    char buffer[64];
+    sprintf(buffer, "%" PRIdOSMID, osm_id);

Opened #916 to cover the existing usage of `sprintf`

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/osm2pgsql/pull/914#pullrequestreview-207689442
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/tile-serving/attachments/20190225/8c19c874/attachment.html>


More information about the Tile-serving mailing list