Skip to content

Commit ae44fbb

Browse files
committed
Use new string_joiner_t utility class in pgsql code
1 parent 0f96f6f commit ae44fbb

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/pgsql.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,18 +130,13 @@ void pg_conn_t::end_copy(std::string const &context) const
130130
static std::string concat_params(int num_params,
131131
char const *const *param_values)
132132
{
133-
std::string params;
133+
util::string_joiner_t joiner{','};
134134

135135
for (int i = 0; i < num_params; ++i) {
136-
params += param_values[i] ? param_values[i] : "<NULL>";
137-
params += ',';
136+
joiner.add(param_values[i] ? param_values[i] : "<NULL>");
138137
}
139138

140-
if (!params.empty()) {
141-
params.resize(params.size() - 1);
142-
}
143-
144-
return params;
139+
return joiner();
145140
}
146141

147142
pg_result_t

0 commit comments

Comments
 (0)