26#ifndef MYSQL_HARNESS_COMMON_INCLUDED
27#define MYSQL_HARNESS_COMMON_INCLUDED
34#include "harness_export.h"
74template <
class InputIt>
76 const std::string &delim =
"and") {
80 }
else if (elements == 2) {
82 out <<
" " << delim <<
" " << *
start;
84 while (elements-- > 0) {
86 if (elements > 0) out <<
", ";
87 if (elements == 1) out << delim <<
" ";
112template <
class InputIt>
114 const std::string &delim =
"and") {
115 std::stringstream out;
140template <
class InputIt>
142 const std::string &delim =
",") {
144 for (
auto cur =
start; cur != finish; ++cur) {
170template <
class Collection>
172 const std::string &delim =
",") {
173 return list_elements(collection.begin(), collection.end(), delim);
180template <
class Key,
class Value>
182 const Value &default_value) {
183 auto iter =
map.find(
key);
184 if (iter ==
map.end())
return default_value;
a nullable SQL value.
Definition: sql_value.h:40
static void start(mysql_harness::PluginFuncEnv *env)
Definition: http_auth_backend_plugin.cc:177
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1052
bool distance(const dd::Spatial_reference_system *srs, const Geometry *g1, const Geometry *g2, double *distance, bool *is_null) noexcept
Computes the distance between two geometries.
Definition: distance.cc:40
std::string_view Key
The key type for the hash structure in HashJoinRowBuffer.
Definition: hash_join_buffer.h:102
HARNESS_EXPORT std::string truncate_string(const std::string &str, size_t max_len=80)
Return a truncated version of input string.
Definition: common.cc:32
Value get_from_map(const std::map< Key, Value > &map, const Key &key, const Value &default_value)
Gets a Value from std::map for given Key.
Definition: common.h:181
void serial_comma(std::ostream &out, InputIt start, InputIt finish, const std::string &delim="and")
Emit a range of elements using the serial comma.
Definition: common.h:75
std::string list_elements(InputIt start, InputIt finish, const std::string &delim=",")
Returns string containing list of the elements separated by selected delimiter.
Definition: common.h:141
std::map< Key, Value, Compare, ut::allocator< std::pair< const Key, Value > > > map
Specialization of map which uses ut_allocator.
Definition: ut0new.h:2893
struct result result
Definition: result.h:34
required string key
Definition: replication_asynchronous_connection_failover.proto:60