O'Reilly logo

MySQL 5.1 Plugin Development by Andrew Hutchings, Sergei Golubchik

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A User Variables Information Schema plugin

In this plugin we will show how to access MySQL's internal data structures—the list of user variables created in a connection. User variables are used to store data that will persist just for one connection inside the MySQL server. Unfortunately, one of their limitations is that there is no way to see what variables have been created. In this example we will develop an Information Schema table that shows them.

User variables are stored in the user_vars member of the THD structure. It is a hash that maps variable names to corresponding user_var_entry objects. We simply need to traverse the hash, and for every user_var_entry element print its name and its value converted to a string.

To be able to see the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required