diff options
author | Sergei Golubchik <serg@mysql.com> | 2009-11-02 21:05:42 +0100 |
---|---|---|
committer | Sergei Golubchik <serg@mysql.com> | 2009-11-02 21:05:42 +0100 |
commit | 3d23068f3a1430d5849ede3f886e7356040bc146 (patch) | |
tree | 7a2815b63cb90a92052843088062861e585a181d /storage/example | |
parent | 2cb9f48bab2c7a7ee921917890ddce6ced58f312 (diff) | |
download | mariadb-git-3d23068f3a1430d5849ede3f886e7356040bc146.tar.gz |
WL#4903 Plugin Service API part I
(mysql-next-mr backport)
Diffstat (limited to 'storage/example')
-rw-r--r-- | storage/example/Makefile.am | 2 | ||||
-rw-r--r-- | storage/example/ha_example.cc | 22 |
2 files changed, 21 insertions, 3 deletions
diff --git a/storage/example/Makefile.am b/storage/example/Makefile.am index ce269aee59b..1179a338ee2 100644 --- a/storage/example/Makefile.am +++ b/storage/example/Makefile.am @@ -34,7 +34,7 @@ noinst_HEADERS = ha_example.h EXTRA_LTLIBRARIES = ha_example.la pkgplugin_LTLIBRARIES = @plugin_example_shared_target@ -ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) +ha_example_la_LDFLAGS = -module -rpath $(pkgplugindir) -L$(top_builddir)/libservices -lmysqlservices ha_example_la_CXXFLAGS= $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_CFLAGS = $(AM_CFLAGS) -DMYSQL_DYNAMIC_PLUGIN ha_example_la_SOURCES = ha_example.cc diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc index 30fc82c82d2..4b982f2943f 100644 --- a/storage/example/ha_example.cc +++ b/storage/example/ha_example.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2003 MySQL AB +/* Copyright (C) 2003 MySQL AB, 2009 Sun Microsystems, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -921,6 +921,24 @@ static struct st_mysql_sys_var* example_system_variables[]= { NULL }; +// this is an example of SHOW_FUNC and of my_snprintf() service +static int show_func_example(MYSQL_THD thd, struct st_mysql_show_var *var, + char *buf) +{ + var->type= SHOW_CHAR; + var->value= buf; // it's of SHOW_VAR_FUNC_BUFF_SIZE bytes + my_snprintf(buf, SHOW_VAR_FUNC_BUFF_SIZE, + "enum_var is %u, ulong_var is %lu, %.6b", // %b is MySQL extension + srv_enum_var, srv_ulong_var, "really"); + return 0; +} + +static struct st_mysql_show_var func_status[]= +{ + {"example_func_example", (char *)show_func_example, SHOW_FUNC}, + {0,0,SHOW_UNDEF} +}; + mysql_declare_plugin(example) { MYSQL_STORAGE_ENGINE_PLUGIN, @@ -932,7 +950,7 @@ mysql_declare_plugin(example) example_init_func, /* Plugin Init */ example_done_func, /* Plugin Deinit */ 0x0001 /* 0.1 */, - NULL, /* status variables */ + func_status, /* status variables */ example_system_variables, /* system variables */ NULL /* config options */ } |