MySQL 9.0.0
Source Code Documentation
s_mysql_mysql_status_variable_string Struct Reference

Service to read the value of a status variable as a string. More...

#include <mysql_status_variable_reader.h>

Public Attributes

mysql_service_status_t(* get )(THD *thd, const char *name, bool get_global, my_h_string *out_string)
 Gets the string value of a status variable. More...

Detailed Description

Service to read the value of a status variable as a string.

Used approximately as follows:

my_h_string value = nullptr;
bool get_global = true; // or false
MYSQL_THD thd = nullptr; // use a temp thd
const char *name = "gizmo";
char buffer[1024];
const char *charset= "utf8mb4";
// try to get the current thd if there is one
if (!get_global && mysql_service_mysql_current_thread_reader->get(&thd)) {
// failed to get the current THD
*is_null = 1;
*error = 1;
return nullptr;
if (!mysql_service_mysql_status_variable_string->get(thd, name, get_global,
&str) && str && !mysql_service_mysql_string_converter->convert_to_buffer( str,
buffer, sizeof(buffer) - 1, charset)) {
// the value is in buffer
// wasn't able to get the value. do cleanup
if (str) mysql_service_mysql_string_factory->destroy(str);
#define MYSQL_THD
Definition: backup_page_tracker.h:38
std::string str(const mysqlrouter::ConfigGenerator::Options::Endpoint &ep)
const std::string charset("charset")
mutable_buffer buffer(void *p, size_t n) noexcept
Definition: buffer.h:418
case opt name
Definition: sslopt-case.h:29
See also

Member Data Documentation

◆ get

mysql_service_status_t(* s_mysql_mysql_status_variable_string::get) (THD *thd, const char *name, bool get_global, my_h_string *out_string)

Gets the string value of a status variable.

Will read the value of the status variable supplied, convert to a string as needed and store into the out_string parameter as a my_h_string.

No status variable values aggregation will be done from the threads to the globals. Will keep the status variable lock while extracting the value.
The function will return an error if you do not supply a session and request the session value.
thdThe THD to operate on or a nullptr to create a temp THD
nameThe name of the status variable to access. US ASCII
get_globaltrue if the global value of the status variable is required, false if the session one.
[out]out_stringa place to store the value
Status of the operation
Return values
See also

The documentation for this struct was generated from the following file: