|
15 | 15 |
|
16 | 16 | table_t::table_t(std::string const &name, std::string const &type, |
17 | 17 | columns_t const &columns, hstores_t const &hstore_columns, |
18 | | - int const srid, bool const append, int const hstore_mode, |
| 18 | + int const srid, bool const append, hstore_column hstore_mode, |
19 | 19 | std::shared_ptr<db_copy_thread_t> const ©_thread) |
20 | 20 | : m_target(std::make_shared<db_target_descr_t>(name.c_str(), "osm_id")), |
21 | 21 | m_type(type), m_srid(fmt::to_string(srid)), m_append(append), |
22 | 22 | m_hstore_mode(hstore_mode), m_columns(columns), |
23 | 23 | m_hstore_columns(hstore_columns), m_copy(copy_thread) |
24 | 24 | { |
25 | 25 | // if we dont have any columns |
26 | | - if (m_columns.empty() && m_hstore_mode != HSTORE_ALL) { |
| 26 | + if (m_columns.empty() && m_hstore_mode != hstore_column::all) { |
27 | 27 | throw std::runtime_error{ |
28 | 28 | "No columns provided for table {}"_format(name)}; |
29 | 29 | } |
@@ -99,7 +99,7 @@ void table_t::start(std::string const &conninfo, std::string const &table_space) |
99 | 99 | } |
100 | 100 |
|
101 | 101 | //add tags column |
102 | | - if (m_hstore_mode != HSTORE_NONE) { |
| 102 | + if (m_hstore_mode != hstore_column::none) { |
103 | 103 | sql += "\"tags\" hstore,"; |
104 | 104 | } |
105 | 105 |
|
@@ -163,7 +163,7 @@ void table_t::generate_copy_column_list() |
163 | 163 | } |
164 | 164 |
|
165 | 165 | //add tags column and geom column |
166 | | - if (m_hstore_mode != HSTORE_NONE) { |
| 166 | + if (m_hstore_mode != hstore_column::none) { |
167 | 167 | m_target->rows += "tags,way"; |
168 | 168 | //or just the geom column |
169 | 169 | } else { |
@@ -264,7 +264,7 @@ void table_t::stop(bool updateable, bool enable_hstore_index, |
264 | 264 | if (enable_hstore_index) { |
265 | 265 | fmt::print(stderr, "Creating hstore indexes on {}\n", |
266 | 266 | m_target->name); |
267 | | - if (m_hstore_mode != HSTORE_NONE) { |
| 267 | + if (m_hstore_mode != hstore_column::none) { |
268 | 268 | m_sql_conn->exec( |
269 | 269 | "CREATE INDEX ON {} USING GIN (tags) {}"_format( |
270 | 270 | m_target->name, tablespace_clause(table_space_index))); |
@@ -303,18 +303,18 @@ void table_t::write_row(osmid_t id, taglist_t const &tags, |
303 | 303 | // used to remember which columns have been written out already. |
304 | 304 | std::vector<bool> used; |
305 | 305 |
|
306 | | - if (m_hstore_mode != HSTORE_NONE) { |
| 306 | + if (m_hstore_mode != hstore_column::none) { |
307 | 307 | used.assign(tags.size(), false); |
308 | 308 | } |
309 | 309 |
|
310 | 310 | //get the regular columns' values |
311 | | - write_columns(tags, m_hstore_mode == HSTORE_NORM ? &used : nullptr); |
| 311 | + write_columns(tags, m_hstore_mode == hstore_column::norm ? &used : nullptr); |
312 | 312 |
|
313 | 313 | //get the hstore columns' values |
314 | 314 | write_hstore_columns(tags); |
315 | 315 |
|
316 | 316 | //get the key value pairs for the tags column |
317 | | - if (m_hstore_mode != HSTORE_NONE) { |
| 317 | + if (m_hstore_mode != hstore_column::none) { |
318 | 318 | write_tags_column(tags, used); |
319 | 319 | } |
320 | 320 |
|
|
0 commit comments