diff options
author | Ashish Agarwal <ashish.y.agarwal@oracle.com> | 2013-05-19 23:38:06 +0530 |
---|---|---|
committer | Ashish Agarwal <ashish.y.agarwal@oracle.com> | 2013-05-19 23:38:06 +0530 |
commit | 0c4f4ff015f7c4a06b9d4c9e8f22f44a57e2a318 (patch) | |
tree | 24753afbd8c14c24de460f691e8e4a67e50a32c8 /include | |
parent | 5ca36b3b46de00e9eb8030c0551e7e97bc8e24eb (diff) | |
download | mariadb-git-0c4f4ff015f7c4a06b9d4c9e8f22f44a57e2a318.tar.gz |
Bug#16194302: SUPPORT FOR FLOATING-POINT SYSTEM VARIABLES
USING THE PLUGIN INTERFACE.
ISSUE: No support for floating-point plugin
system variables.
SOLUTION: Allowing plugins to define and expose floating-point
system variables of type double. MYSQL_SYSVAR_DOUBLE
and MYSQL_THDVAR_DOUBLE are added.
ISSUE: Fractional part of the def, min, max values of system
variables are ignored.
SOLUTION: Adding functions that are used to store the raw
representation of a double in the raw bits of unsigned
longlong in a way that the binary representation
remains the same.
Diffstat (limited to 'include')
-rw-r--r-- | include/my_getopt.h | 3 | ||||
-rw-r--r-- | include/mysql/plugin.h | 11 |
2 files changed, 14 insertions, 0 deletions
diff --git a/include/my_getopt.h b/include/my_getopt.h index 04278c061a5..2b84267a237 100644 --- a/include/my_getopt.h +++ b/include/my_getopt.h @@ -120,6 +120,9 @@ double getopt_double_limit_value(double num, const struct my_option *optp, my_bool *fix); my_bool getopt_compare_strings(const char *s, const char *t, uint length); +ulonglong getopt_double2ulonglong(double); +double getopt_ulonglong2double(ulonglong); + C_MODE_END #endif /* _my_getopt_h */ diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index c8cdfe2a0b8..0dced1b5a53 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -163,6 +163,7 @@ typedef int (*mysql_show_var_func)(MYSQL_THD, struct st_mysql_show_var*, char *) #define PLUGIN_VAR_STR 0x0005 #define PLUGIN_VAR_ENUM 0x0006 #define PLUGIN_VAR_SET 0x0007 +#define PLUGIN_VAR_DOUBLE 0x0008 #define PLUGIN_VAR_UNSIGNED 0x0080 #define PLUGIN_VAR_THDLOCAL 0x0100 /* Variable is per-connection */ #define PLUGIN_VAR_READONLY 0x0200 /* Server variable is read only */ @@ -345,6 +346,11 @@ DECLARE_MYSQL_SYSVAR_TYPELIB(name, unsigned long long) = { \ PLUGIN_VAR_SET | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, &varname, def, typelib } +#define MYSQL_SYSVAR_DOUBLE(name, varname, opt, comment, check, update, def, min, max, blk) \ +DECLARE_MYSQL_SYSVAR_SIMPLE(name, double) = { \ + PLUGIN_VAR_DOUBLE | ((opt) & PLUGIN_VAR_MASK), \ + #name, comment, check, update, &varname, def, min, max, blk } + #define MYSQL_THDVAR_BOOL(name, opt, comment, check, update, def) \ DECLARE_MYSQL_THDVAR_BASIC(name, char) = { \ PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ @@ -395,6 +401,11 @@ DECLARE_MYSQL_THDVAR_TYPELIB(name, unsigned long long) = { \ PLUGIN_VAR_SET | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ #name, comment, check, update, -1, def, NULL, typelib } +#define MYSQL_THDVAR_DOUBLE(name, opt, comment, check, update, def, min, max, blk) \ +DECLARE_MYSQL_THDVAR_SIMPLE(name, double) = { \ + PLUGIN_VAR_DOUBLE | PLUGIN_VAR_THDLOCAL | ((opt) & PLUGIN_VAR_MASK), \ + #name, comment, check, update, -1, def, min, max, blk, NULL } + /* accessor macros */ #define SYSVAR(name) \ |