MySQL 8.4.2
Source Code Documentation
mysql_command_services_imp Class Reference

An implementation of mysql command services apis. More...

#include <mysql_command_services_imp.h>

Static Public Member Functions

static mysql_service_status_t init (MYSQL_H *mysql_h) noexcept
 Calls mysql_init() api to Gets or initializes a MYSQL structure. More...
 
static mysql_service_status_t connect (MYSQL_H mysql_h) noexcept
 Calls mysql_real_connect api to connect to a MySQL server. More...
 
static mysql_service_status_t reset (MYSQL_H mysql_h) noexcept
 Calls mysql_reset_connection api to resets the connection to clear session state. More...
 
static mysql_service_status_t close (MYSQL_H mysql_h) noexcept
 Calls mysql_close api to closes a server connection. More...
 
static mysql_service_status_t commit (MYSQL_H mysql_h) noexcept
 Calls mysql_commit api to commits the transaction. More...
 
static mysql_service_status_t autocommit (MYSQL_H mysql_h, bool mode) noexcept
 Calls mysql_autocommit api to toggles autocommit mode on/off. More...
 
static mysql_service_status_t rollback (MYSQL_H mysql_h) noexcept
 Calls mysql_rollback api to rolls back the transaction. More...
 
static mysql_service_status_t init (void) noexcept
 Calls session init_thread() to initialize a physical thread to use the session service. More...
 
static void end (void) noexcept
 Calls session deinit_thread() to deinitialize a physical thread that has been using the session service. More...
 
static mysql_service_status_t set (MYSQL_H mysql, int option, const void *arg) noexcept
 Calls mysql_options api to sets connect options for connection-establishment functions such as real_connect(). More...
 
static mysql_service_status_t get (MYSQL_H mysql, int option, const void *arg) noexcept
 Calls mysql_get_option api to returns the value of a mysql_options() option. More...
 
static mysql_service_status_t query (MYSQL_H mysql, const char *stmt_str, unsigned long length) noexcept
 Calls mysql_real_query api to executes an SQL query specified as a counted string. More...
 
static mysql_service_status_t affected_rows (MYSQL_H mysql, uint64_t *rows) noexcept
 Calls mysql_affected_rows api to return the number of rows changed/deleted/inserted by the last UPDATE,DELETE or INSERT query. More...
 
static mysql_service_status_t store_result (MYSQL_H mysql, MYSQL_RES_H *mysql_res) noexcept
 Calls mysql_store_result api to retrieves a complete result set. More...
 
static mysql_service_status_t use_result (MYSQL_H mysql, MYSQL_RES_H *mysql_res) noexcept
 
static mysql_service_status_t free_result (MYSQL_RES_H mysql_res) noexcept
 Calls mysql_free_result api to frees memory used by a result set. More...
 
static mysql_service_status_t more_results (MYSQL_H mysql) noexcept
 Calls mysql_more_results api to checks whether any more results exist. More...
 
static int next_result (MYSQL_H mysql) noexcept
 Calls mysql_next_result api to returns/initiates the next result in multiple-result executions. More...
 
static mysql_service_status_t result_metadata (MYSQL_RES_H res_h) noexcept
 Calls mysql_result_metadata api to check whether a result set has metadata. More...
 
static mysql_service_status_t fetch_row (MYSQL_RES_H res_h, char ***row) noexcept
 Calls mysql_fetch_row api to fetches the next row from the result set. More...
 
static mysql_service_status_t fetch_lengths (MYSQL_RES_H res_h, ulong **length) noexcept
 Calls mysql_fetch_lengths api to Returns the lengths of all columns in the current row. More...
 
static mysql_service_status_t fetch_field (MYSQL_RES_H res_h, MYSQL_FIELD_H *field_h) noexcept
 Calls mysql_fetch_field api to returns the type of next table field. More...
 
static mysql_service_status_t num_fields (MYSQL_RES_H res_h, unsigned int *num_fields) noexcept
 Calls mysql_num_fields api to returns the number of columns in a result set. More...
 
static mysql_service_status_t fetch_fields (MYSQL_RES_H res_h, MYSQL_FIELD_H **fields_h) noexcept
 Calls mysql_fetch_fields api to returns an array of all field structures. More...
 
static mysql_service_status_t field_count (MYSQL_H mysql_h, unsigned int *num_fields) noexcept
 Calls mysql_field_count api to returns the number of columns for the most resent statement. More...
 
static mysql_service_status_t sql_errno (MYSQL_H mysql_h, unsigned int *err_no) noexcept
 Calls mysql_errno api to return the number of most recently invoked mysql function. More...
 
static mysql_service_status_t sql_error (MYSQL_H mysql_h, char **errmsg) noexcept
 Calls mysql_error api to return the error message of most recently invoked mysql function. More...
 
static mysql_service_status_t sql_state (MYSQL_H mysql_h, char **sqlstate_errmsg) noexcept
 Calls mysql_sqlstate api to return the SQLSTATE error code for the last error. More...
 
static mysql_service_status_t field_metadata_get (MYSQL_FIELD_H field_h, int metadata, void *data) noexcept
 

Detailed Description

An implementation of mysql command services apis.

Member Function Documentation

◆ affected_rows()

mysql_service_status_t mysql_command_services_imp::affected_rows ( MYSQL_H  mysql_h,
uint64_t *  rows 
)
staticnoexcept

Calls mysql_affected_rows api to return the number of rows changed/deleted/inserted by the last UPDATE,DELETE or INSERT query.

Parameters
[in]mysql_hA valid mysql object.
[out]*rowsNumber of rows affected, for SELECT stmt it tells about number of rows present.
Return values
truefailure
falsesuccess

◆ autocommit()

mysql_service_status_t mysql_command_services_imp::autocommit ( MYSQL_H  mysql_h,
bool  mode 
)
staticnoexcept

Calls mysql_autocommit api to toggles autocommit mode on/off.

Parameters
[in]mysql_hA valid mysql object.
[in]modeSets autocommit mode on if mode is 1, off if mode is 0.
Return values
truefailure
falsesuccess

◆ close()

mysql_service_status_t mysql_command_services_imp::close ( MYSQL_H  mysql_h)
staticnoexcept

Calls mysql_close api to closes a server connection.

Parameters
[in]mysql_hA valid mysql object.
Return values
truefailure
falsesuccess

◆ commit()

mysql_service_status_t mysql_command_services_imp::commit ( MYSQL_H  mysql_h)
staticnoexcept

Calls mysql_commit api to commits the transaction.

Parameters
[in]mysql_hA valid mysql object.
Return values
truefailure
falsesuccess

◆ connect()

mysql_service_status_t mysql_command_services_imp::connect ( MYSQL_H  mysql_h)
staticnoexcept

Calls mysql_real_connect api to connect to a MySQL server.

Parameters
[in]mysql_hA valid mysql object.
Return values
truefailure
falsesuccess

◆ end()

void mysql_command_services_imp::end ( void  )
staticnoexcept

Calls session deinit_thread() to deinitialize a physical thread that has been using the session service.

◆ fetch_field()

mysql_service_status_t mysql_command_services_imp::fetch_field ( MYSQL_RES_H  res_h,
MYSQL_FIELD_H field_h 
)
staticnoexcept

Calls mysql_fetch_field api to returns the type of next table field.

Parameters
[in]res_hAn mysql result object to return the next table field.
[out]*field_hStores the definition of one column of a result set as a MYSQL_FIELD structure
Return values
truefailure
falsesuccess

◆ fetch_fields()

mysql_service_status_t mysql_command_services_imp::fetch_fields ( MYSQL_RES_H  res_h,
MYSQL_FIELD_H **  fields_h 
)
staticnoexcept

Calls mysql_fetch_fields api to returns an array of all field structures.

Parameters
[in]res_hA valid mysql result set object.
[out]**fields_hStores the array of all fields for a result set.
Return values
truefailure
falsesuccess

◆ fetch_lengths()

mysql_service_status_t mysql_command_services_imp::fetch_lengths ( MYSQL_RES_H  res_h,
ulong **  length 
)
staticnoexcept

Calls mysql_fetch_lengths api to Returns the lengths of all columns in the current row.

Parameters
[in]res_hAn mysql result object to fetch a row from the result set.
[out]*lengthlengths of all columns.
Return values
truefailure
falsesuccess

◆ fetch_row()

mysql_service_status_t mysql_command_services_imp::fetch_row ( MYSQL_RES_H  res_h,
char ***  row_h 
)
staticnoexcept

Calls mysql_fetch_row api to fetches the next row from the result set.

Parameters
[in]res_hAn mysql result object to fetch a row from the result set.
[out]*row_hTo store the fetched row
Return values
truefailure
falsesuccess

◆ field_count()

mysql_service_status_t mysql_command_services_imp::field_count ( MYSQL_H  mysql_h,
unsigned int *  num_fields 
)
staticnoexcept

Calls mysql_field_count api to returns the number of columns for the most resent statement.

Parameters
[in]mysql_hA valid mysql handle object.
[out]*num_fieldsStores the number of columns for the last stmt.
Return values
truefailure
falsesuccess

◆ field_metadata_get()

mysql_service_status_t mysql_command_services_imp::field_metadata_get ( MYSQL_FIELD_H  field_h,
int  metadata,
void *  data 
)
staticnoexcept

◆ free_result()

mysql_service_status_t mysql_command_services_imp::free_result ( MYSQL_RES_H  mysql_res_h)
staticnoexcept

Calls mysql_free_result api to frees memory used by a result set.

Parameters
[in]mysql_res_hAn mysql result object to free the result set.
Return values
truefailure
falsesuccess

◆ get()

mysql_service_status_t mysql_command_services_imp::get ( MYSQL_H  mysql_h,
int  option,
const void *  arg 
)
staticnoexcept

Calls mysql_get_option api to returns the value of a mysql_options() option.

Parameters
[in]mysql_hA valid mysql object.
[in]optionThe option argument is the option that you want to get.
[out]argThe arg argument is the value for the option to store.
Return values
truefailure
falsesuccess

◆ init() [1/2]

mysql_service_status_t mysql_command_services_imp::init ( MYSQL_H mysql_h)
staticnoexcept

Calls mysql_init() api to Gets or initializes a MYSQL structure.

Parameters
[out]mysql_hPrepared mysql object from mysql_init call.
Return values
truefailure
falsesuccess

◆ init() [2/2]

mysql_service_status_t mysql_command_services_imp::init ( void  )
staticnoexcept

Calls session init_thread() to initialize a physical thread to use the session service.

Return values
truefailure
falsesuccess

◆ more_results()

mysql_service_status_t mysql_command_services_imp::more_results ( MYSQL_H  mysql_h)
staticnoexcept

Calls mysql_more_results api to checks whether any more results exist.

Parameters
[in]mysql_hA valid mysql object.
Return values
truefailure
falsesuccess

◆ next_result()

int mysql_command_services_imp::next_result ( MYSQL_H  mysql_h)
staticnoexcept

Calls mysql_next_result api to returns/initiates the next result in multiple-result executions.

Parameters
[in]mysql_hA valid mysql object.
Return values
-1no more results
>0error
0if yes more results exits(keep looping)

◆ num_fields()

mysql_service_status_t mysql_command_services_imp::num_fields ( MYSQL_RES_H  res_h,
unsigned int *  num_fields 
)
staticnoexcept

Calls mysql_num_fields api to returns the number of columns in a result set.

Parameters
[in]res_hA valid mysql result set object.
[out]*num_fieldsStores the number of columns in the result set.
Return values
truefailure
falsesuccess

◆ query()

mysql_service_status_t mysql_command_services_imp::query ( MYSQL_H  mysql_h,
const char *  stmt_str,
unsigned long  length 
)
staticnoexcept

Calls mysql_real_query api to executes an SQL query specified as a counted string.

Parameters
[in]mysql_hA valid mysql object.
[in]stmt_strSQL statement pointed to by the null-terminated string. The stmt is in mysql server character set.
[in]lengthA string length bytes long.
Return values
truefailure
falsesuccess

◆ reset()

mysql_service_status_t mysql_command_services_imp::reset ( MYSQL_H  mysql_h)
staticnoexcept

Calls mysql_reset_connection api to resets the connection to clear session state.

Parameters
[in]mysql_hA valid mysql object.
Return values
truefailure
falsesuccess

◆ result_metadata()

mysql_service_status_t mysql_command_services_imp::result_metadata ( MYSQL_RES_H  res_h)
staticnoexcept

Calls mysql_result_metadata api to check whether a result set has metadata.

Parameters
[in]res_hAn mysql result object to get the metadata info. metadata_info Tells metadata is present or not. 0 for none 1 for present
Return values
truefailure metadata_info not present.
falsesuccess metadata_info present.

◆ rollback()

mysql_service_status_t mysql_command_services_imp::rollback ( MYSQL_H  mysql_h)
staticnoexcept

Calls mysql_rollback api to rolls back the transaction.

Parameters
[in]mysql_hA valid mysql object.
Return values
truefailure
falsesuccess

◆ set()

mysql_service_status_t mysql_command_services_imp::set ( MYSQL_H  mysql_h,
int  option,
const void *  arg 
)
staticnoexcept

Calls mysql_options api to sets connect options for connection-establishment functions such as real_connect().

Parameters
[in]mysql_hA valid mysql object.
[in]optionThe option argument is the option that you want to set.
[in]argThe arg argument is the value for the option.

-----------—+----------------------------—+-----------------------------—+ Type | Option |Explanation | -----------—+----------------------------—+-----------------------------—+ const char * |MYSQL_COMMAND_CONSUMER_SERVICE |The service (implementation) | | |name/prefix to look for in the | | |registry and direct all the | | |calls to. | -----------—+----------------------------—+-----------------------------—+ MYSQL_THD |MYSQL_COMMAND_LOCAL_THD_HANDLE |The THD to run the query in. | | |If null a new internal THD will | | |be created. | -----------—+----------------------------—+-----------------------------—+ const char * |MYSQL_COMMAND_PROTOCOL |Could be valid socket meaning co| | |nnect to remote server, could be| | |"local"(default) meaning connect| | |to the current server. | -----------—+----------------------------—+-----------------------------—+ const char * |MYSQL_COMMAND_USER_NAME |The user name to send to the | | |server/set into the thread's | | |security context. | -----------—+----------------------------—+-----------------------------—+ const char * |MYSQL_COMMAND_HOST_NAME |The host name to use to | | |connect/set into the thread's | | |security context. | -----------—+----------------------------—+-----------------------------—+ int |MYSQL_COMMAND_TCPIP_PORT |The port to use to connect. | -----------—+----------------------------—+-----------------------------—+ bool |MYSQL_NO_LOCK_REGISTRY |Flag to use the _no_lock | | |implementation of registry | | |service. | -----------—+----------------------------—+-----------------------------—+

Note
For the other mysql client options it calls the mysql_options api from this api.
Return values
truefailure
falsesuccess

◆ sql_errno()

mysql_service_status_t mysql_command_services_imp::sql_errno ( MYSQL_H  mysql_h,
unsigned int *  err_no 
)
staticnoexcept

Calls mysql_errno api to return the number of most recently invoked mysql function.

Parameters
[in]mysql_hA valid mysql handle object.
[out]*err_noStores the error number of last mysql function.
Return values
truefailure
falsesuccess

◆ sql_error()

mysql_service_status_t mysql_command_services_imp::sql_error ( MYSQL_H  mysql_h,
char **  errmsg 
)
staticnoexcept

Calls mysql_error api to return the error message of most recently invoked mysql function.

Parameters
[in]mysql_hA valid mysql handle object.
[out]*errmsgStores the error message of last mysql function.
Return values
truefailure
falsesuccess

◆ sql_state()

mysql_service_status_t mysql_command_services_imp::sql_state ( MYSQL_H  mysql_h,
char **  sqlstate_errmsg 
)
staticnoexcept

Calls mysql_sqlstate api to return the SQLSTATE error code for the last error.

Parameters
[in]mysql_hA valid mysql handle object.
[out]*sqlstate_errmsgStores the SQLSTATE error message of the most recently executed SQL stmt.
Return values
truefailure
falsesuccess

◆ store_result()

mysql_service_status_t mysql_command_services_imp::store_result ( MYSQL_H  mysql_h,
MYSQL_RES_H mysql_res 
)
staticnoexcept

Calls mysql_store_result api to retrieves a complete result set.

Parameters
[in]mysql_hA valid mysql object.
[out]*mysql_resAn mysql result object to get the result set.
Return values
truefailure
falsesuccess

◆ use_result()

static mysql_service_status_t mysql_command_services_imp::use_result ( MYSQL_H  mysql,
MYSQL_RES_H mysql_res 
)
staticnoexcept

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