File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 1414#include < cstdlib>
1515#include < stdexcept>
1616#include < string>
17+ #include < string_view>
1718
1819#include " format.hpp"
1920#include " options.hpp"
@@ -76,7 +77,8 @@ class conn_t : public pg_conn_t
7677 return res;
7778 }
7879
79- int get_count (char const *table_name, std::string const &where = " " ) const
80+ int get_count (std::string_view table_name,
81+ std::string_view where = " " ) const
8082 {
8183 auto const query =
8284 fmt::format (" SELECT count(*) FROM {} {} {}" , table_name,
@@ -85,7 +87,7 @@ class conn_t : public pg_conn_t
8587 return result_as_int (query);
8688 }
8789
88- void require_has_table (char const * table_name) const
90+ void require_has_table (std::string_view table_name) const
8991 {
9092 auto const where = fmt::format (" oid = '{}'::regclass" , table_name);
9193
Original file line number Diff line number Diff line change @@ -67,14 +67,14 @@ TEST_CASE("Store and retrieve properties (with database)")
6767 std::string const full_table_name =
6868 (schema.empty () ? " " : schema + " ." ) + " osm2pgsql_properties" ;
6969
70- REQUIRE (conn.get_count (full_table_name. c_str () ) == 4 );
71- REQUIRE (conn.get_count (full_table_name. c_str () ,
70+ REQUIRE (conn.get_count (full_table_name) == 4 );
71+ REQUIRE (conn.get_count (full_table_name,
7272 " property='foo' AND value='bar'" ) == 1 );
73- REQUIRE (conn.get_count (full_table_name. c_str () ,
73+ REQUIRE (conn.get_count (full_table_name,
7474 " property='empty' AND value=''" ) == 1 );
75- REQUIRE (conn.get_count (full_table_name. c_str () ,
75+ REQUIRE (conn.get_count (full_table_name,
7676 " property='number' AND value='123'" ) == 1 );
77- REQUIRE (conn.get_count (full_table_name. c_str () ,
77+ REQUIRE (conn.get_count (full_table_name,
7878 " property='decide' AND value='true'" ) == 1 );
7979
8080 properties_t properties{db.conninfo (), schema};
You can’t perform that action at this time.
0 commit comments