Skip to content

Commit de247d3

Browse files
committed
Add _t suffix to class binary_param
1 parent 0906d75 commit de247d3

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/gen/gen-rivers.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ SELECT "{id_column}", "{width_column}", "{name_column}", "{geom_column}"
345345
geom::geometry_t const geom{std::move(edge.points), PROJ_SPHERE_MERC};
346346
auto const wkb = geom_to_ewkb(geom);
347347
connection().exec_prepared("ins", edge.id, edge.width,
348-
get_name(names, edge.id), binary_param(wkb));
348+
get_name(names, edge.id),
349+
binary_param_t(wkb));
349350
}
350351
connection().exec("COMMIT");
351352
timer(m_timer_write).stop();

src/gen/gen-tile-raster.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ void gen_tile_raster_union_t::process(tile_t const &tile)
237237
timer(m_timer_write).start();
238238
for (auto const &geom : geometries) {
239239
auto const wkb = geom_to_ewkb(geom);
240-
connection().exec_prepared("insert_geoms", binary_param{wkb},
240+
connection().exec_prepared("insert_geoms", binary_param_t{wkb},
241241
tile.x(), tile.y(), param);
242242
}
243243
timer(m_timer_write).stop();

src/pgsql.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,12 @@ class pg_result_t
138138
* Wrapper class for query parameters that should be sent to the database
139139
* as binary parameter.
140140
*/
141-
class binary_param : public std::string_view
141+
class binary_param_t : public std::string_view
142142
{
143143
public:
144144
using std::string_view::string_view;
145145

146-
explicit binary_param(std::string const &str)
146+
explicit binary_param_t(std::string const &str)
147147
: std::string_view(str.data(), str.size())
148148
{}
149149
};
@@ -272,7 +272,7 @@ class pg_conn_t
272272
{
273273
if constexpr (std::is_same_v<T, char const *> ||
274274
std::is_same_v<T, std::string> ||
275-
std::is_same_v<T, binary_param>) {
275+
std::is_same_v<T, binary_param_t>) {
276276
return 0;
277277
}
278278
return 1;
@@ -293,7 +293,7 @@ class pg_conn_t
293293
} else if constexpr (std::is_same_v<T, std::string>) {
294294
*length = static_cast<int>(param.size());
295295
return param.c_str();
296-
} else if constexpr (std::is_same_v<T, binary_param>) {
296+
} else if constexpr (std::is_same_v<T, binary_param_t>) {
297297
*length = static_cast<int>(param.size());
298298
*bin = 1;
299299
return param.data();

tests/test-pgsql.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ TEST_CASE("exec_prepared with binary parameter should work")
105105
auto const conn = db.db().connect();
106106
conn.exec("PREPARE test(bytea) AS SELECT length($1)");
107107

108-
binary_param const p{"foo \x01 bar"};
108+
binary_param_t const p{"foo \x01 bar"};
109109
auto const result = conn.exec_prepared("test", p);
110110
REQUIRE(result.status() == PGRES_TUPLES_OK);
111111
REQUIRE(result.num_fields() == 1);
@@ -120,7 +120,7 @@ TEST_CASE("exec_prepared with mixed parameter types should work")
120120
" SELECT length($1) + length($2) + $3");
121121

122122
std::string const p1{"foo bar"};
123-
binary_param const p2{"foo \x01 bar"};
123+
binary_param_t const p2{"foo \x01 bar"};
124124
int const p3 = 17;
125125
auto const result = conn.exec_prepared("test", p1, p2, p3);
126126
REQUIRE(result.status() == PGRES_TUPLES_OK);

0 commit comments

Comments
 (0)