Databases Reference
In-Depth Information
To create session, or thread-local, variables we need to use a different set of macros.
They start with MYSQL_THDVAR instead of MYSQL_SYSVAR , and they do not take the
varname parameter:
Macro to Create a Session Variable
Corresponding C Type
MYSQL_THDVAR_BOOL(name, opt, comment, check,
update, def)
char
MYSQL_THDVAR_STR(name, opt, comment, check,
update, def)
char*
MYSQL_THDVAR_INT(name, opt, comment, check,
update, def, min, max, blk)
int
MYSQL_THDVAR_UINT(name, opt, comment, check,
update, def, min, max, blk)
unsigned int
MYSQL_THDVAR_LONG(name, opt, comment, check,
update, def, min, max, blk)
long
MYSQL_THDVAR_ULONG(name, opt, comment, check,
update, def, min, max, blk)
unsigned long
MYSQL_THDVAR_LONGLONG(name, opt, comment, check,
update, def, min, max, blk)
long long
MYSQL_THDVAR_ULONGLONG(name, opt, comment,
check, update, def, min, max, blk)
unsigned long
long
MYSQL_THDVAR_ENUM(name, opt, comment, check,
update, def, typelib)
unsigned long
MYSQL_THDVAR_SET(name, opt, comment, check,
update, def, typelib)
unsigned long
long
The parameters of all these macros are as follows:
Name
Description
name
The name of the system variable, excluding the plugin name. It will be shown
in SHOW VARIABLES ; it can be used in SELECT and SET , or on the command
line. The name of the plugin will be prepended to the name automatically.
varname
The associated C or C++ variable. A global system variable ( MYSQL_SYSVAR )
will store its value in this C or C++ variable. Session variables ( MYSQL_THDVAR )
have no varname parameter; the storage for the value will be created
automatically in every thread as necessary.
opt
System variable options, see the following table.
comment
The comment describing the system variable. If a variable can
be set on the command line, this comment will be visible in the
mysqld --help --verbose output.
check
A pointer to a function that checks if the value is valid. It can be NULL .
update
A pointer to a function used to store the new value. It can be NULL too.
Search WWH ::




Custom Search