Skip to content

Commit 449475d

Browse files
committed
Avoid generating a std::string
1 parent e677068 commit 449475d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/db-copy.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ void db_deleter_by_id_t::delete_rows(std::string const &table,
2121
}
2222
sql[sql.size() - 1] = ')';
2323

24-
conn->exec(fmt::to_string(sql));
24+
sql.push_back('\0');
25+
conn->exec(sql.data());
2526
}
2627

2728
void db_deleter_by_type_and_id_t::delete_rows(std::string const &table,
@@ -54,8 +55,6 @@ void db_deleter_by_type_and_id_t::delete_rows(std::string const &table,
5455
") AS t (osm_type, osm_id) WHERE"
5556
" p.{} = t.osm_type AND p.{} = t.osm_id",
5657
type, column.c_str() + pos + 1);
57-
58-
conn->exec(fmt::to_string(sql));
5958
} else {
6059
fmt::format_to(sql, FMT_STRING("DELETE FROM {} WHERE {} IN ("), table,
6160
column);
@@ -64,8 +63,10 @@ void db_deleter_by_type_and_id_t::delete_rows(std::string const &table,
6463
format_to(sql, FMT_STRING("{},"), item.osm_id);
6564
}
6665
sql[sql.size() - 1] = ')';
67-
conn->exec(fmt::to_string(sql));
6866
}
67+
68+
sql.push_back('\0');
69+
conn->exec(sql.data());
6970
}
7071

7172
db_copy_thread_t::db_copy_thread_t(std::string const &conninfo)

0 commit comments

Comments
 (0)