MySQL 8.4.2
Source Code Documentation
|
THD Attributes service allows to obtain data associated with the THD object, which keeps various attributes of the user session. More...
#include <mysql_thd_attributes.h>
Public Attributes | |
mysql_service_status_t(* | get )(THD *thd, const char *name, void *inout_pvalue) |
Get THD attribute. More... | |
mysql_service_status_t(* | set )(THD *thd, const char *name, void *inout_pvalue) |
Set THD attribute. More... | |
THD Attributes service allows to obtain data associated with the THD object, which keeps various attributes of the user session.
Currently, following attributes are supported:
The service can be instantiated using the registry service with the "mysql_thd_attributes" name.
Query Digest represents converted SQL statement to normalized form. The code below demonstrates how query digest can be obtained from the service.
The buffer can be fetched using the code below:
After the string content has been copied into another buffer, it must be destroyed:
Query text represents complete SQL text currently being executed within a given session. The example code is identical to the one for Query Digest, the only difference is that attribute name "sql_text" should be used in this case.
Host or IP text contains host or IP (if host unavailable) belonging to a client associated with a given session. The example code is identical to the one for Query Digest, the only difference is that attribute name "host_or_ip" should be used in this case.
Schema text contains a name of database currently in use by a client associated with a given session. The example code is identical to the one for Query Digest, the only difference is that attribute name "schema" should be used in this case.
mysql_service_status_t(* s_mysql_mysql_thd_attributes::get) (THD *thd, const char *name, void *inout_pvalue) |
Get THD attribute.
Currently, following attributes are supported:
thd | Session THD object. | |
name | Name of the attribute to be set. | |
[out] | inout_pvalue | Iterator pointer. |
FALSE | Succeeded. |
TRUE | Failed. |
mysql_service_status_t(* s_mysql_mysql_thd_attributes::set) (THD *thd, const char *name, void *inout_pvalue) |
Set THD attribute.
Currently the implementation does not support setting of any attribute.
thd | Session THD object. | |
name | Name of the attribute to be set. | |
[out] | inout_pvalue | Iterator pointer. |