MySQL 9.1.0
Source Code Documentation
s_mysql_mysql_system_variable_update_string Struct Reference

Service to set the value of system variables. More...

#include <mysql_system_variable.h>

Public Attributes

mysql_service_status_t(* set )(THD *thd, const char *set_variable_type, my_h_string variable_name_base, my_h_string variable_name, my_h_string variable_value)
 Sets the value of a system variable to a new string value. More...
 

Detailed Description

Service to set the value of system variables.

This is an example of using the service:

MYSQL_THD thd = nullptr;
if (!make_new_thread &&
mysql_service_mysql_current_thread_reader->get(&thd)) {
*error = 1;
return 0;
}
const char *cs = "latin1";
const char *base_input = "my_component"; //nullptr if not a component variable
const char *name_input = "my_variable";
const char *value_input = "value";
const char *type = "GLOBAL";
my_h_string base = nullptr, name = nullptr, value = nullptr;
mysql_service_mysql_string_factory->create(&base);
mysql_service_mysql_string_factory->create(&name);
mysql_service_mysql_string_factory->create(&value);
if ((base_input != nullptr &&
mysql_service_mysql_string_converter->convert_from_buffer(
&base, base_input, strlen(base_input), cs)) ||
mysql_service_mysql_string_converter->convert_from_buffer(
&name, name_input, strlen(name_input), cs) ||
mysql_service_mysql_string_converter->convert_from_buffer(
&value, value_input, strlen(value_input), cs) {
if (base) mysql_service_mysql_string_factory->destroy(base);
if (name) mysql_service_mysql_string_factory->destroy(name);
if (value) mysql_service_mysql_string_factory->destroy(value);
*error = 1;
return 0;
}
if (mysql_service_mysql_system_variable_update_string->set(thd, type,
base, name, value)) *error = 1;
if (base) mysql_service_mysql_string_factory->destroy(base);
if (name) mysql_service_mysql_string_factory->destroy(name);
if (value) mysql_service_mysql_string_factory->destroy(value);
#define MYSQL_THD
Definition: backup_page_tracker.h:38
if(!(yy_init))
Definition: lexyy.cc:1144
Definition: commit_order_queue.h:34
required string type
Definition: replication_group_member_actions.proto:34
case opt name
Definition: sslopt-case.h:29
Definition: mysql_string_service.cc:60
See also
mysql_system_variable_update_imp

Member Data Documentation

◆ set

mysql_service_status_t(* s_mysql_mysql_system_variable_update_string::set) (THD *thd, const char *set_variable_type, my_h_string variable_name_base, my_h_string variable_name, my_h_string variable_value)

Sets the value of a system variable to a new string value.

Parameters
thdthread session handle. if NULL a temp one will be created and then removed.
set_variable_typeone of [GLOBAL, PERSIST, PERSIST_ONLY]. If NULL, then assumes GLOBAL.
variable_name_basea mysql string of the variable name prefix. NULL of none
variable_namea mysql string of the variable name
variable_valuea mysql string to set as value
Return values
FALSEsuccess
TRUEfailure, see THD if supplied.

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