26#ifndef _UTILS_SQLSTRING_H_
27#define _UTILS_SQLSTRING_H_
31#ifndef __STDC_FORMAT_MACROS
32#define __STDC_FORMAT_MACROS 1
50 bool wildcards =
false);
54 const char quote_char);
70 std::string consume_until_next_escape();
85 operator std::string()
const;
86 std::string
str()
const;
104 template <
typename T>
106 int esc = next_escape();
108 throw std::invalid_argument(
109 "Error formatting SQL query: invalid escape for numeric argument");
111 append(consume_until_next_escape());
Definition: utils_sqlstring.h:58
sqlstringformat _format
Definition: utils_sqlstring.h:68
sqlstring(const sqlstring ©)
std::string _formatted
Definition: utils_sqlstring.h:66
sqlstring & operator=(const sqlstring &)=default
static const sqlstring end
Definition: utils_sqlstring.h:77
sqlstring & operator<<(const T value)
replaces a ? in the format string with any integer numeric value
Definition: utils_sqlstring.h:105
sqlstring & operator<<(const float val)
replaces a ? in the format string with a float numeric value
Definition: utils_sqlstring.h:91
std::string _format_string_left
Definition: utils_sqlstring.h:67
static int flags[50]
Definition: hp_test1.cc:40
static std::string to_string(const LEX_STRING &str)
Definition: lex_string.h:50
void copy(Shards< COUNT > &dst, const Shards< COUNT > &src) noexcept
Copy the counters, overwrite destination.
Definition: ut0counter.h:354
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
Definition: config_generator.cc:1105
SqlStringFlags
Definition: utils_sqlstring.h:41
@ UseAnsiQuotes
Definition: utils_sqlstring.h:43
@ EndOfInput
Definition: utils_sqlstring.h:45
@ QuoteOnlyIfNeeded
Definition: utils_sqlstring.h:42
std::string ROUTER_MYSQL_EXPORT escape_backticks(const std::string &string)
Definition: utils_sqlstring.cc:326
ROUTER_UTILS_EXPORT std::ostream & operator<<(std::ostream &strm, const URI &uri)
Definition: uri.cc:1205
std::string ROUTER_MYSQL_EXPORT quote_identifier(const std::string &identifier, const char quote_char)
Definition: utils_sqlstring.cc:371
std::string ROUTER_MYSQL_EXPORT escape_sql_string(const std::string &string, bool wildcards=false)
Escape a string to be used in a SQL query Same code as used by mysql.
Definition: utils_sqlstring.cc:277
std::string ROUTER_MYSQL_EXPORT quote_identifier_if_needed(const std::string &ident, const char quote_char)
Quotes the given identifier, but only if it needs to be quoted.
Definition: utils_sqlstring.cc:384
#define ROUTER_MYSQL_EXPORT
Definition: router_mysql_export.h:15