26#ifndef MRS_COMPONENT_COMMAND_EXECUTOR_H
27#define MRS_COMPONENT_COMMAND_EXECUTOR_H
42using Row = std::vector<std::string>;
77 void set_query(
const std::string &query_text);
91 throw std::logic_error(
"Invalid mode");
95 sizeof(
T),
nullptr, 0) != 0) {
122 std::optional<std::string> connect_user = std::nullopt,
123 std::optional<std::string> connect_host = std::nullopt);
Definition: mrs_component_command_executor.h:52
unsigned int m_error_code
Definition: mrs_component_command_executor.h:60
Connection_error(const std::string &message, unsigned int error_code)
Definition: mrs_component_command_executor.h:54
unsigned int error_code() const
Definition: mrs_component_command_executor.h:57
Executes text queries and prepared statements through component services.
Definition: mrs_component_command_executor.h:48
std::optional< std::string > get_string_result()
Definition: mrs_component_command_executor.cc:477
Command_executor & operator=(const Command_executor &)=delete
std::optional< int64_t > get_int64_result()
Definition: mrs_component_command_executor.cc:437
std::string fetch_column_as_string(my_h_statement stmt, my_h_row row, uint32_t col_index)
Definition: mrs_component_command_executor.cc:174
void reset() noexcept
Definition: mrs_component_command_executor.cc:142
void bind_param(uint32_t index, const T &value, uint64_t type, bool is_unsigned=false)
Definition: mrs_component_command_executor.h:88
std::string m_query
Definition: mrs_component_command_executor.h:137
void cleanup()
Definition: mrs_component_command_executor.cc:130
void set_query(const std::string &query_text)
Definition: mrs_component_command_executor.cc:158
void connect()
Definition: mrs_component_command_executor.cc:74
std::string escape_string(const std::string &input)
Definition: mrs_component_command_executor.cc:395
void bind_param(uint32_t index, const std::string &value, uint64_t type, bool is_unsigned=false)
Definition: mrs_component_command_executor.cc:353
std::string get_last_error() const
Definition: mrs_component_command_executor.cc:406
Mode
Definition: mrs_component_command_executor.h:50
bool is_explicit_mode() const
Definition: mrs_component_command_executor.h:108
std::string m_connect_user
Definition: mrs_component_command_executor.h:149
Command_executor(Command_executor &&)=delete
void execute_query(Resultset *result)
Definition: mrs_component_command_executor.cc:298
MYSQL_RES_H m_mysql_res
Definition: mrs_component_command_executor.h:145
std::optional< uint64_t > get_uint64_result()
Definition: mrs_component_command_executor.cc:417
Mode mode() const
Definition: mrs_component_command_executor.h:109
void execute_statement(Resultset *result)
Definition: mrs_component_command_executor.cc:263
bool m_explicit_ctx_mode
Definition: mrs_component_command_executor.h:139
Command_executor(const Command_executor &)=delete
~Command_executor()
Definition: mrs_component_command_executor.cc:72
Command_executor()=delete
unsigned int m_last_error_code
Definition: mrs_component_command_executor.h:152
int get_last_error_code() const
Definition: mrs_component_command_executor.h:112
my_h_statement m_stmt
Definition: mrs_component_command_executor.h:144
Security_context_handle m_security_context
Definition: mrs_component_command_executor.h:147
uint64_t affected_rows()
Definition: mrs_component_command_executor.cc:372
const std::string & get_query() const
Definition: mrs_component_command_executor.h:110
bool fetch(my_h_row *row)
Definition: mrs_component_command_executor.cc:363
Mode m_mode
Definition: mrs_component_command_executor.h:138
static Command_executor make_with_explicit_ctx(std::string user, std::string host, Mode mode)
Definition: mrs_component_command_executor.cc:44
static Command_executor make_with_current_ctx(Mode mode)
Definition: mrs_component_command_executor.cc:40
std::optional< double > get_double_result()
Definition: mrs_component_command_executor.cc:457
void execute(Resultset *result=nullptr)
Definition: mrs_component_command_executor.cc:255
Mysql_command_service_session m_command_service_session
Definition: mrs_component_command_executor.h:143
Command_executor & operator=(Command_executor &&)=delete
void bind_param(uint32_t index, const char *value, uint64_t type, bool is_unsigned=false)
Definition: mrs_component_command_executor.h:83
std::string m_connect_host
Definition: mrs_component_command_executor.h:150
uint64_t last_insert_id()
Definition: mrs_component_command_executor.cc:384
Owns the component command-service handle and optional thread initialization.
Definition: mrs_component_mysql_command_service_session.h:45
struct Security_context_handle_imp * Security_context_handle
Definition: dynamic_privilege.h:29
#define T
Definition: jit_executor_value.cc:373
struct MYSQL_RES_H_imp * MYSQL_RES_H
Definition: mysql_command_services.h:34
struct my_h_row_imp * my_h_row
Definition: mysql_statement_service.h:36
struct my_h_statement_imp * my_h_statement
Definition: mysql_statement_service.h:35
const char * host
Definition: mysqladmin.cc:66
constexpr value_type is_unsigned
Definition: classic_protocol_constants.h:273
bool index(const std::string &value, const String &search_for, uint32_t *idx)
Definition: contains.h:76
ValueType value(const std::optional< ValueType > &v)
Definition: gtid.h:83
Definition: mrs_component.cc:137
std::vector< Row > Resultset
Definition: mrs_component_command_executor.h:43
std::vector< std::string > Row
Definition: mrs_component_command_executor.h:42
noexcept
The return type for any call_and_catch(f, args...) call where f(args...) returns Type.
Definition: call_and_catch.h:76
Define std::hash<Gtid>.
Definition: gtid.h:355
required string type
Definition: replication_group_member_actions.proto:34
Definition: classic_prepared_statement.h:33