MySQL 26.10.0
Source Code Documentation
mrs_component::Command_executor Class Reference

Executes text queries and prepared statements through component services. More...

#include <mrs_component_command_executor.h>

Classes

class  Connection_error
 

Public Types

enum class  Mode : uint8_t { Query , PreparedStatement }
 

Public Member Functions

 ~Command_executor ()
 
 Command_executor ()=delete
 
 Command_executor (const Command_executor &)=delete
 
Command_executor & operator= (const Command_executor &)=delete
 
 Command_executor (Command_executor &&)=delete
 
Command_executor & operator= (Command_executor &&)=delete
 
void set_query (const std::string &query_text)
 
void execute (Resultset *result=nullptr)
 
void bind_param (uint32_t index, const std::string &value, uint64_t type, bool is_unsigned=false)
 
void bind_param (uint32_t index, const char *value, uint64_t type, bool is_unsigned=false)
 
template<typename T >
void bind_param (uint32_t index, const T &value, uint64_t type, bool is_unsigned=false)
 
bool fetch (my_h_row *row)
 
uint64_t affected_rows ()
 
uint64_t last_insert_id ()
 
std::string escape_string (const std::string &input)
 
bool is_explicit_mode () const
 
Mode mode () const
 
const std::string & get_query () const
 
std::string get_last_error () const
 
int get_last_error_code () const
 
std::optional< uint64_t > get_uint64_result ()
 
std::optional< int64_t > get_int64_result ()
 
std::optional< double > get_double_result ()
 
std::optional< std::string > get_string_result ()
 

Static Public Member Functions

static Command_executor make_with_current_ctx (Mode mode)
 
static Command_executor make_with_explicit_ctx (std::string user, std::string host, Mode mode)
 

Private Member Functions

 Command_executor (Mode mode, bool threaded_mode, std::optional< std::string > connect_user=std::nullopt, std::optional< std::string > connect_host=std::nullopt)
 
void connect ()
 
void cleanup ()
 
void reset () noexcept
 
void execute_query (Resultset *result)
 
void execute_statement (Resultset *result)
 
std::string fetch_column_as_string (my_h_statement stmt, my_h_row row, uint32_t col_index)
 

Private Attributes

std::string m_query
 
Mode m_mode
 
bool m_explicit_ctx_mode = false
 
Mysql_command_service_session m_command_service_session
 
my_h_statement m_stmt = nullptr
 
MYSQL_RES_H m_mysql_res = nullptr
 
Security_context_handle m_security_context
 
std::string m_connect_user
 
std::string m_connect_host
 
unsigned int m_last_error_code {0}
 

Detailed Description

Executes text queries and prepared statements through component services.

Member Enumeration Documentation

◆ Mode

enum class mrs_component::Command_executor::Mode : uint8_t
strong
Enumerator
Query 
PreparedStatement 

Constructor & Destructor Documentation

◆ ~Command_executor()

mrs_component::Command_executor::~Command_executor ( )

◆ Command_executor() [1/4]

mrs_component::Command_executor::Command_executor ( )
delete

◆ Command_executor() [2/4]

mrs_component::Command_executor::Command_executor ( const Command_executor &  )
delete

◆ Command_executor() [3/4]

mrs_component::Command_executor::Command_executor ( Command_executor &&  )
delete

◆ Command_executor() [4/4]

mrs_component::Command_executor::Command_executor ( Mode  mode,
bool  threaded_mode,
std::optional< std::string >  connect_user = std::nullopt,
std::optional< std::string >  connect_host = std::nullopt 
)
private

Member Function Documentation

◆ affected_rows()

uint64_t mrs_component::Command_executor::affected_rows ( )

◆ bind_param() [1/3]

void mrs_component::Command_executor::bind_param ( uint32_t  index,
const char *  value,
uint64_t  type,
bool  is_unsigned = false 
)
inline

◆ bind_param() [2/3]

void mrs_component::Command_executor::bind_param ( uint32_t  index,
const std::string &  value,
uint64_t  type,
bool  is_unsigned = false 
)

◆ bind_param() [3/3]

template<typename T >
void mrs_component::Command_executor::bind_param ( uint32_t  index,
const T &  value,
uint64_t  type,
bool  is_unsigned = false 
)
inline

◆ cleanup()

void mrs_component::Command_executor::cleanup ( )
private

◆ connect()

void mrs_component::Command_executor::connect ( )
private

◆ escape_string()

std::string mrs_component::Command_executor::escape_string ( const std::string &  input)

◆ execute()

void mrs_component::Command_executor::execute ( Resultset *  result = nullptr)

◆ execute_query()

void mrs_component::Command_executor::execute_query ( Resultset *  result)
private

◆ execute_statement()

void mrs_component::Command_executor::execute_statement ( Resultset *  result)
private

◆ fetch()

bool mrs_component::Command_executor::fetch ( my_h_row *  row)

◆ fetch_column_as_string()

std::string mrs_component::Command_executor::fetch_column_as_string ( my_h_statement  stmt,
my_h_row  row,
uint32_t  col_index 
)
private

◆ get_double_result()

std::optional< double > mrs_component::Command_executor::get_double_result ( )

◆ get_int64_result()

std::optional< int64_t > mrs_component::Command_executor::get_int64_result ( )

◆ get_last_error()

std::string mrs_component::Command_executor::get_last_error ( ) const

◆ get_last_error_code()

int mrs_component::Command_executor::get_last_error_code ( ) const
inline

◆ get_query()

const std::string & mrs_component::Command_executor::get_query ( ) const
inline

◆ get_string_result()

std::optional< std::string > mrs_component::Command_executor::get_string_result ( )

◆ get_uint64_result()

std::optional< uint64_t > mrs_component::Command_executor::get_uint64_result ( )

◆ is_explicit_mode()

bool mrs_component::Command_executor::is_explicit_mode ( ) const
inline

◆ last_insert_id()

uint64_t mrs_component::Command_executor::last_insert_id ( )

◆ make_with_current_ctx()

Command_executor mrs_component::Command_executor::make_with_current_ctx ( Mode  mode)
static

◆ make_with_explicit_ctx()

Command_executor mrs_component::Command_executor::make_with_explicit_ctx ( std::string  user,
std::string  host,
Mode  mode 
)
static

◆ mode()

Mode mrs_component::Command_executor::mode ( ) const
inline

◆ operator=() [1/2]

Command_executor & mrs_component::Command_executor::operator= ( Command_executor &&  )
delete

◆ operator=() [2/2]

Command_executor & mrs_component::Command_executor::operator= ( const Command_executor &  )
delete

◆ reset()

void mrs_component::Command_executor::reset ( )
privatenoexcept

◆ set_query()

void mrs_component::Command_executor::set_query ( const std::string &  query_text)

Member Data Documentation

◆ m_command_service_session

Mysql_command_service_session mrs_component::Command_executor::m_command_service_session
private

◆ m_connect_host

std::string mrs_component::Command_executor::m_connect_host
private

◆ m_connect_user

std::string mrs_component::Command_executor::m_connect_user
private

◆ m_explicit_ctx_mode

bool mrs_component::Command_executor::m_explicit_ctx_mode = false
private

◆ m_last_error_code

unsigned int mrs_component::Command_executor::m_last_error_code {0}
private

◆ m_mode

Mode mrs_component::Command_executor::m_mode
private

◆ m_mysql_res

MYSQL_RES_H mrs_component::Command_executor::m_mysql_res = nullptr
private

◆ m_query

std::string mrs_component::Command_executor::m_query
private

◆ m_security_context

Security_context_handle mrs_component::Command_executor::m_security_context
private
Initial value:
{
nullptr}

◆ m_stmt

my_h_statement mrs_component::Command_executor::m_stmt = nullptr
private

The documentation for this class was generated from the following files: