Skip to content

Commit c437d96

Browse files
committed
remove exec sql function from db_copy class
1 parent 5540083 commit c437d96

File tree

2 files changed

+0
-43
lines changed

2 files changed

+0
-43
lines changed

db-copy.cpp

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ void db_copy_thread_t::worker_thread()
7373
case db_cmd_t::Cmd_copy:
7474
write_to_db(static_cast<db_cmd_copy_t *>(item.get()));
7575
break;
76-
case db_cmd_t::Cmd_sql:
77-
execute_sql(static_cast<db_cmd_sql_t *>(item.get())->buffer);
78-
break;
7976
case db_cmd_t::Cmd_sync:
8077
finish_copy();
8178
static_cast<db_cmd_sync_t *>(item.get())->barrier.set_value();
@@ -107,13 +104,6 @@ void db_copy_thread_t::connect()
107104
"SET synchronous_commit TO off;");
108105
}
109106

110-
void db_copy_thread_t::execute_sql(std::string const &sql_cmd)
111-
{
112-
finish_copy();
113-
114-
pgsql_exec_simple(m_conn, PGRES_COMMAND_OK, sql_cmd.c_str());
115-
}
116-
117107
void db_copy_thread_t::disconnect()
118108
{
119109
if (!m_conn)
@@ -218,17 +208,6 @@ void db_copy_mgr_t::delete_id(osmid_t osm_id)
218208
m_current->deletables.push_back(osm_id);
219209
}
220210

221-
void db_copy_mgr_t::exec_sql(std::string const &sql_cmd)
222-
{
223-
// finish any ongoing copy operations
224-
if (m_current) {
225-
m_processor->add_buffer(std::move(m_current));
226-
}
227-
228-
// and add SQL command
229-
m_processor->add_buffer(std::unique_ptr<db_cmd_t>(new db_cmd_sql_t(sql_cmd)));
230-
}
231-
232211
void db_copy_mgr_t::sync()
233212
{
234213
// finish any ongoing copy operations

db-copy.hpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ class db_cmd_t
4444
enum cmd_t
4545
{
4646
Cmd_copy, ///< Copy buffer content into given target.
47-
Cmd_sql, ///< Execute buffer content as SQL command.
4847
Cmd_sync, ///< Synchronize with parent.
4948
Cmd_finish
5049
};
@@ -75,18 +74,6 @@ struct db_cmd_copy_t : public db_cmd_t
7574
}
7675
};
7776

78-
struct db_cmd_sql_t : public db_cmd_t
79-
{
80-
/// actual copy buffer
81-
std::string buffer;
82-
83-
explicit db_cmd_sql_t(std::string const &sql_command)
84-
: db_cmd_t(db_cmd_t::Cmd_sql), buffer(sql_command)
85-
{
86-
}
87-
88-
};
89-
9077
struct db_cmd_sync_t : public db_cmd_t
9178
{
9279
std::promise<void> barrier;
@@ -135,7 +122,6 @@ class db_copy_thread_t
135122
void connect();
136123
void disconnect();
137124

138-
void execute_sql(std::string const &sql_cmd);
139125
void write_to_db(db_cmd_copy_t *buffer);
140126
void start_copy(std::shared_ptr<db_target_descr_t> const &target);
141127
void finish_copy();
@@ -259,14 +245,6 @@ class db_copy_mgr_t
259245
*/
260246
void delete_id(osmid_t osm_id);
261247

262-
/**
263-
* Run an SQL statement.
264-
*
265-
* The statement is run in order. That means any previously submitted
266-
* copyblocks are finished first.
267-
*/
268-
void exec_sql(std::string const &sql_cmd);
269-
270248
/**
271249
* Synchronize with worker.
272250
*

0 commit comments

Comments
 (0)