diff options
author | serg@serg.mylan <> | 2006-01-07 14:41:57 +0100 |
---|---|---|
committer | serg@serg.mylan <> | 2006-01-07 14:41:57 +0100 |
commit | cfbaad99524f858c956644fd08fd3e5bf8facf84 (patch) | |
tree | 8e78176cd0cc3972339c3fdd16ca56c31ab3bcdb /plugin | |
parent | 8241a5a8e89af766c43024c4920a1b5102948aed (diff) | |
download | mariadb-git-cfbaad99524f858c956644fd08fd3e5bf8facf84.tar.gz |
WL#2935 - SHOW STATUS support in plugins
The patch adds DYNAMIC_ARRAY all_status_vars, which is now the
sole source of status information for SHOW STATUS. Status
variables can be added to and removed from the array dynamically.
SHOW STATUS command uses this array instead of static array
from mysqld.cc
Compatibility with the old, global list of status variables is
preserved in init_server_components(), where this global list is
simply appended to all_status_vars.
Diffstat (limited to 'plugin')
-rw-r--r-- | plugin/fulltext/plugin_example.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/plugin/fulltext/plugin_example.c b/plugin/fulltext/plugin_example.c index c222d3d85c3..4caa6de3197 100644 --- a/plugin/fulltext/plugin_example.c +++ b/plugin/fulltext/plugin_example.c @@ -18,6 +18,8 @@ #include <m_ctype.h> #include <plugin.h> +long number_of_calls= 0; /* for SHOW STATUS, see below */ + /* Simple full-text parser plugin that acts as a replacement for the built-in full-text parser: @@ -167,6 +169,8 @@ int simple_parser_parse(MYSQL_FTPARSER_PARAM *param) { char *end, *start, *docend= param->doc + param->length; + number_of_calls++; + for (end= start= param->doc;; end++) { if (end == docend) @@ -198,6 +202,16 @@ static struct st_mysql_ftparser simple_parser_descriptor= simple_parser_deinit /* parser deinit function */ }; +/* + Plugin status variables for SHOW STATUS +*/ + +struct st_mysql_show_var simple_status[]= +{ + {"static", "just a static text", SHOW_CHAR}, + {"called", (char *)&number_of_calls, SHOW_LONG}, + {0,0,0} +}; /* Plugin library descriptor @@ -211,6 +225,8 @@ mysql_declare_plugin "MySQL AB", /* author */ "Simple Full-Text Parser", /* description */ simple_parser_plugin_init, /* init function (when loaded) */ - simple_parser_plugin_deinit /* deinit function (when unloaded) */ + simple_parser_plugin_deinit,/* deinit function (when unloaded) */ + 0x0001, /* version */ + &simple_status /* status variables */ } mysql_declare_plugin_end; |