-
Book Overview & Buying
-
Table Of Contents
MySQL 5.1 Plugin Development
By :
In the previous chapter we created a Daemon plugin that exported getrusage() data via status variables. For the sake of the example we will now do the same with the Information Schema table. However, to not repeat ourselves we will go beyond getrusage() and will also use other Linux system information functions. Yes, unfortunately this plugin is unlikely to work on anything except Linux. One can create a portable system information plugin by using, for example, the SIGAR library (http://sigar.hyperic.com) but for simplicity we will keep the example free from external dependencies.
#include <mysql_priv.h> #include <sys/sysinfo.h> bool schema_table_store_record(THD *thd, TABLE *table);
We start the plugin as usual, with the exception of sys/sysinfo.h that we need for system information functions. Then we declare fields; for simplicity we will use a name/value pair, the value being a long long integer:
static ST_FIELD_INFO sys_usage_fields[] =
{
{"RESOURCE...
Change the font size
Change margin width
Change background colour