1414#include " overloaded.hpp"
1515#include " pgsql.hpp"
1616
17- std::string to_string (param_value_t const &value)
18- {
19- return std::visit (
20- overloaded{[](null_param_t ) { return std::string{}; },
21- [](std::string val) { return val; },
22- [](auto const &val) { return fmt::to_string (val); }},
23- value);
24- }
25-
2617param_value_t params_t::get (std::string const &key) const
2718{
2819 return m_map.at (key);
@@ -58,7 +49,7 @@ double params_t::get_double(std::string const &key, double default_value) const
5849 return static_cast <double >(std::get<int64_t >(it->second ));
5950 }
6051
61- throw fmt_error (" Invalid value '{}' for {}." , to_string ( it->second ) , key);
52+ throw fmt_error (" Invalid value '{}' for {}." , it->second , key);
6253}
6354
6455std::string params_t::get_string (std::string const &key) const
@@ -67,7 +58,7 @@ std::string params_t::get_string(std::string const &key) const
6758 if (it == m_map.end ()) {
6859 throw fmt_error (" Missing parameter '{}' on generalizer." , key);
6960 }
70- return to_string ( it->second );
61+ return fmt::format ( " {} " , it->second );
7162}
7263
7364std::string params_t::get_string (std::string const &key,
@@ -82,7 +73,7 @@ std::string params_t::get_identifier(std::string const &key) const
8273 if (it == m_map.end ()) {
8374 return {};
8475 }
85- std::string result = to_string ( it->second );
76+ std::string result = fmt::format ( " {} " , it->second );
8677 check_identifier (result, key.c_str ());
8778 return result;
8879}
@@ -94,7 +85,7 @@ void params_t::check_identifier_with_default(std::string const &key,
9485 if (it == m_map.end ()) {
9586 m_map.emplace (key, std::move (default_value));
9687 } else {
97- check_identifier (to_string ( it->second ), key.c_str ());
88+ check_identifier (fmt::format ( " {} " , it->second ), key.c_str ());
9889 }
9990}
10091
@@ -120,6 +111,6 @@ void write_to_debug_log(params_t const ¶ms, char const *message)
120111 }
121112 log_debug (" {}" , message);
122113 for (auto const &[key, value] : params) {
123- log_debug (" {}={}" , key, to_string ( value) );
114+ log_debug (" {}={}" , key, value);
124115 }
125116}
0 commit comments