Skip to content

Commit 8d2e4b8

Browse files
authored
Merge pull request #2172 from joto/remove-old-db-middle
Remove support for legacy middle database format
2 parents fef8e5c + 94a8d33 commit 8d2e4b8

File tree

12 files changed

+51
-615
lines changed

12 files changed

+51
-615
lines changed

man/osm2pgsql.1

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -203,16 +203,6 @@ Set ID shift for way node bucket index in middle.
203203
Experts only.
204204
See documentation for details.
205205
.TP
206-
--middle-database-format=FORMAT
207-
Set the database format for the middle tables to FORMAT.
208-
Allowed formats are \f[B]new\f[R] (default) and \f[B]legacy\f[R] .
209-
The \f[B]legacy\f[R] format is deprecated and will be removed in version
210-
2.0.0.
211-
See the manual for details on these formats.
212-
(Only works with \f[B]--slim\f[R].
213-
In append mode osm2pgsql will automatically detect the database format,
214-
so don\[cq]t use this with \f[B]-a, --append\f[R].)
215-
.TP
216206
--middle-with-nodes
217207
Used together with the \f[B]new\f[R] middle database format when a flat
218208
nodes file is used to force storing nodes with tags in the database,

man/osm2pgsql.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,6 @@ mandatory for short options too.
176176
: Set ID shift for way node bucket index in middle. Experts only. See
177177
documentation for details.
178178

179-
\--middle-database-format=FORMAT
180-
: Set the database format for the middle tables to FORMAT. Allowed formats
181-
are **new** (default) and **legacy** . The **legacy** format is deprecated
182-
and will be removed in version 2.0.0. See the manual for details on these
183-
formats. (Only works with **\--slim**. In append mode osm2pgsql will
184-
automatically detect the database format, so don't use this with
185-
**-a, \--append**.)
186-
187179
\--middle-with-nodes
188180
: Used together with the **new** middle database format when a flat nodes
189181
file is used to force storing nodes with tags in the database, too.

src/command-line-parser.cpp

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,8 @@ void print_version()
131131

132132
static void check_options_non_slim(CLI::App const &app)
133133
{
134-
std::array<std::string, 7> const slim_options = {
134+
std::array<std::string, 6> const slim_options = {
135135
"--flat-nodes",
136-
"--middle-database-format",
137136
"--middle-schema",
138137
"--middle-with-nodes",
139138
"--middle-way-node-index-id-shift",
@@ -525,13 +524,6 @@ options_t parse_command_line(int argc, char *argv[])
525524
->type_name("SCHEMA")
526525
->group("Middle options");
527526

528-
std::string middle_database_format_raw;
529-
// --middle-database-format
530-
app.add_option("--middle-database-format", middle_database_format_raw)
531-
->description("Set middle db format ('legacy', 'new' (default)).")
532-
->type_name("FORMAT")
533-
->group("Middle options");
534-
535527
// --middle-with-nodes
536528
app.add_flag("--middle-with-nodes", options.middle_with_nodes)
537529
->description("Store tagged nodes in db (new middle db format only).")
@@ -651,28 +643,7 @@ options_t parse_command_line(int argc, char *argv[])
651643
check_options(&options);
652644

653645
if (options.slim) { // slim mode, use database middle
654-
if (middle_database_format_raw.empty()) {
655-
// Database format not set on the command line, use defaults. For
656-
// append mode we keep old default for backwards compatibility, for
657-
// create mode the new format is the default. (These will possibly
658-
// be overwritten later by properties setting if it exists.)
659-
options.middle_database_format = options.append ? 1 : 2;
660-
} else if (options.append) {
661-
// Database format set on command line in append mode.
662-
throw std::runtime_error{
663-
"Do not use --middle-database-format with --append."};
664-
} else {
665-
// Database format set on the command line in create mode.
666-
if (middle_database_format_raw == "legacy") {
667-
options.middle_database_format = 1;
668-
} else if (middle_database_format_raw == "new") {
669-
options.middle_database_format = 2;
670-
} else {
671-
throw std::runtime_error{
672-
"Unknown value for --middle-database-format"
673-
" (Use 'legacy' or 'new')."};
674-
}
675-
}
646+
options.middle_database_format = 2;
676647
} else { // non-slim mode, use ram middle
677648
check_options_non_slim(app);
678649
}

src/db-copy-mgr.hpp

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -121,23 +121,12 @@ class db_copy_mgr_t
121121
* Adds the value in the format appropriate for an array and a value
122122
* separator.
123123
*/
124-
template <typename T>
125-
void add_array_elem(T value)
124+
void add_array_elem(osmid_t value)
126125
{
127126
add_value(value);
128127
m_current->buffer += ',';
129128
}
130129

131-
void add_array_elem(std::string const &s) { add_array_elem(s.c_str()); }
132-
133-
void add_array_elem(char const *s)
134-
{
135-
assert(m_current);
136-
m_current->buffer += '"';
137-
add_escaped_string(s);
138-
m_current->buffer += "\",";
139-
}
140-
141130
/**
142131
* Finish an array column previously started with new_array().
143132
*

0 commit comments

Comments
 (0)