MySQL 8.4.0
Source Code Documentation
Sql_service_interface Class Reference

#include <sql_service_interface.h>

Public Member Functions

 Sql_service_interface (enum cs_text_or_binary cs_txt_bin=CS_TEXT_REPRESENTATION, const CHARSET_INFO *cs_charset=&my_charset_utf8mb3_general_ci)
 Sql_service_interface constructor - Non-threaded version. More...
 
 ~Sql_service_interface ()
 Sql_service_interface destructor. More...
 
int open_session ()
 Opens an server session for internal server connection. More...
 
int open_thread_session (void *plugin_ptr)
 Opens an threaded server session for internal server connection. More...
 
long execute_query (std::string query_string)
 Executes a server command in a session. More...
 
long execute_query (std::string sql_string, Sql_resultset *rset, enum cs_text_or_binary cs_txt_bin=CS_TEXT_REPRESENTATION, const CHARSET_INFO *cs_charset=&my_charset_utf8mb3_general_ci)
 Executes a server command in a session. More...
 
long execute (COM_DATA cmd, enum enum_server_command cmd_type, Sql_resultset *rset, enum cs_text_or_binary cs_txt_bin=CS_TEXT_REPRESENTATION, const CHARSET_INFO *cs_charset=&my_charset_utf8mb3_general_ci)
 Executes a server command in a session. More...
 
void set_send_resulttype (enum cs_text_or_binary field_type)
 Set send result type to CS_TEXT_REPRESENTATION or CS_BINARY_REPRESENTATION. More...
 
void set_charset (const CHARSET_INFO *charset)
 set charset for the string data input(com_query for example) More...
 
int is_session_killed (MYSQL_SESSION session)
 Returns whether the session was killed. More...
 
uint64_t get_session_id ()
 Returns the ID of a session. More...
 
MYSQL_SESSION get_session ()
 Returns the MYSQL_SESSION object. More...
 
int set_session_user (const char *user)
 Set the session associated user. More...
 
bool is_acl_disabled ()
 Check if the server is running without user privileges. More...
 

Private Member Functions

long execute_internal (Sql_resultset *rset, enum cs_text_or_binary cs_txt_bin, const CHARSET_INFO *cs_charset, COM_DATA cmd, enum enum_server_command cmd_type)
 Executes a server command in a session. More...
 
int wait_for_session_server (ulong total_timeout)
 Wait for server to be in SERVER_OPERATING state. More...
 
long configure_session ()
 Configures the session's session variables. More...
 

Private Attributes

MYSQL_SESSION m_session
 Pointer to Srv_session class. More...
 
void * m_plugin
 Pointer to the group_replication plugin structure. More...
 
enum cs_text_or_binary m_txt_or_bin
 send result in string or native types More...
 
const CHARSET_INFOm_charset
 

Constructor & Destructor Documentation

◆ Sql_service_interface()

Sql_service_interface::Sql_service_interface ( enum cs_text_or_binary  cs_txt_bin = CS_TEXT_REPRESENTATION,
const CHARSET_INFO cs_charset = &my_charset_utf8mb3_general_ci 
)

Sql_service_interface constructor - Non-threaded version.

Initializes sql_service_context class

Parameters
cs_txt_binsend result in string or native types i.e. to CS_TEXT_REPRESENTATION or CS_BINARY_REPRESENTATION
cs_charsetcharset for the string data input

◆ ~Sql_service_interface()

Sql_service_interface::~Sql_service_interface ( )

Sql_service_interface destructor.

Member Function Documentation

◆ configure_session()

long Sql_service_interface::configure_session ( )
private

Configures the session's session variables.

Returns
the sql error number
Return values
0OK
>0SQL Error Number returned from MySQL Service API
<0local errors

◆ execute()

long Sql_service_interface::execute ( COM_DATA  cmd,
enum enum_server_command  cmd_type,
Sql_resultset rset,
enum cs_text_or_binary  cs_txt_bin = CS_TEXT_REPRESENTATION,
const CHARSET_INFO cs_charset = &my_charset_utf8mb3_general_ci 
)

Executes a server command in a session.

Parameters
cmdcommand service data input structure containing command details (query/database/session id..). Check include/mysql/com_data.h for more details.
cmd_typecommand type default set is COM_QUERY
rsetresulted obtained after executing query
cs_txt_binsend result in string or native types i.e. to CS_TEXT_REPRESENTATION or CS_BINARY_REPRESENTATION
cs_charsetcharset for the string data input
Returns
the sql error number
Return values
0OK
>0SQL Error Number returned from MySQL Service API
<0local errors

◆ execute_internal()

long Sql_service_interface::execute_internal ( Sql_resultset rset,
enum cs_text_or_binary  cs_txt_bin,
const CHARSET_INFO cs_charset,
COM_DATA  cmd,
enum enum_server_command  cmd_type 
)
private

Executes a server command in a session.

Parameters
rsetresulted obtained after executing query
cs_txt_binsend result in string or native types i.e. to CS_TEXT_REPRESENTATION or CS_BINARY_REPRESENTATION
cs_charsetcharset for the string data input
cmdcommand service data input structure containing command details (query/database/session id..). Check include/mysql/com_data.h for more details.
cmd_typecommand type default set is COM_QUERY
Returns
the sql error number
Return values
0OK
>0SQL Error Number returned from MySQL Service API
-1Internal server session failed or was killed
-2Internal API failure

◆ execute_query() [1/2]

long Sql_service_interface::execute_query ( std::string  query_string)

Executes a server command in a session.

Note
the command type here is COM_QUERY
Parameters
query_stringquery to be executed
Returns
the sql error number
Return values
0OK
>0SQL Error Number returned from MySQL Service API
<0local errors

◆ execute_query() [2/2]

long Sql_service_interface::execute_query ( std::string  sql_string,
Sql_resultset rset,
enum cs_text_or_binary  cs_txt_bin = CS_TEXT_REPRESENTATION,
const CHARSET_INFO cs_charset = &my_charset_utf8mb3_general_ci 
)

Executes a server command in a session.

Parameters
sql_stringquery to be executed
rsetresulted obtained after executing query
cs_txt_binsend result in string or native types i.e. to CS_TEXT_REPRESENTATION or CS_BINARY_REPRESENTATION
cs_charsetcharset for the string data input
Note
the command type here is COM_QUERY
Returns
the sql error number
Return values
0OK
>0SQL Error Number returned from MySQL Service API
<0local errors

◆ get_session()

MYSQL_SESSION Sql_service_interface::get_session ( )
inline

Returns the MYSQL_SESSION object.

Returns
thread ID

◆ get_session_id()

uint64_t Sql_service_interface::get_session_id ( )
inline

Returns the ID of a session.

Returns
thread ID

◆ is_acl_disabled()

bool Sql_service_interface::is_acl_disabled ( )

Check if the server is running without user privileges.

Return values
truethe server is skipping the grant table
falseuser privileges are working normally

◆ is_session_killed()

int Sql_service_interface::is_session_killed ( MYSQL_SESSION  session)
inline

Returns whether the session was killed.

Return values
0not killed
1killed

◆ open_session()

int Sql_service_interface::open_session ( )

Opens an server session for internal server connection.

Returns
the operation status
Return values
0OK
!=0Error

◆ open_thread_session()

int Sql_service_interface::open_thread_session ( void *  plugin_ptr)

Opens an threaded server session for internal server connection.

Parameters
plugin_ptra plugin pointer passed the connection thread.
Returns
the operation status
Return values
0OK
!=0Error

◆ set_charset()

void Sql_service_interface::set_charset ( const CHARSET_INFO charset)
inline

set charset for the string data input(com_query for example)

Parameters
charsetcharset for the string data input

◆ set_send_resulttype()

void Sql_service_interface::set_send_resulttype ( enum cs_text_or_binary  field_type)
inline

Set send result type to CS_TEXT_REPRESENTATION or CS_BINARY_REPRESENTATION.

Parameters
field_typesend result in string or native types i.e. to CS_TEXT_REPRESENTATION or CS_BINARY_REPRESENTATION

◆ set_session_user()

int Sql_service_interface::set_session_user ( const char *  user)

Set the session associated user.

Parameters
userthe user to change to
Return values
0all ok
1error

◆ wait_for_session_server()

int Sql_service_interface::wait_for_session_server ( ulong  total_timeout)
private

Wait for server to be in SERVER_OPERATING state.

Parameters
total_timeoutnumber of seconds to wait for session server
Returns
session server availability
Return values
0session server is in SERVER_OPERATING state
1timeout
-1session server shutdown in progress

Member Data Documentation

◆ m_charset

const CHARSET_INFO* Sql_service_interface::m_charset
private

◆ m_plugin

void* Sql_service_interface::m_plugin
private

Pointer to the group_replication plugin structure.

◆ m_session

MYSQL_SESSION Sql_service_interface::m_session
private

Pointer to Srv_session class.

◆ m_txt_or_bin

enum cs_text_or_binary Sql_service_interface::m_txt_or_bin
private

send result in string or native types


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