diff options
author | He Zhenxing <zhenxing.he@sun.com> | 2009-09-26 12:49:49 +0800 |
---|---|---|
committer | He Zhenxing <zhenxing.he@sun.com> | 2009-09-26 12:49:49 +0800 |
commit | 623ed58cfda0aef6b6bf545a4200357a58a8a4cc (patch) | |
tree | 28e6a4c77de3c3073b4dbe0b0e09e019adeaa556 /include | |
parent | e465d113832aeac61a36902c7976d455e1525234 (diff) | |
download | mariadb-git-623ed58cfda0aef6b6bf545a4200357a58a8a4cc.tar.gz |
Backporting WL#4398 WL#1720
Backporting BUG#44058 BUG#42244 BUG#45672 BUG#45673
Backporting BUG#45819 BUG#45973 BUG#39012
Diffstat (limited to 'include')
-rw-r--r-- | include/mysql/plugin.h | 77 | ||||
-rw-r--r-- | include/mysql/plugin.h.pp | 12 |
2 files changed, 88 insertions, 1 deletions
diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index 2e59262d061..45d0234cb67 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -16,6 +16,11 @@ #ifndef _my_plugin_h #define _my_plugin_h +/* size_t */ +#include <stdlib.h> + +typedef struct st_mysql MYSQL; + /* On Windows, exports from DLL need to be declared @@ -75,7 +80,8 @@ typedef struct st_mysql_xid MYSQL_XID; #define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */ #define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */ #define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */ -#define MYSQL_MAX_PLUGIN_TYPE_NUM 5 /* The number of plugin types */ +#define MYSQL_REPLICATION_PLUGIN 5 /* The replication plugin type */ +#define MYSQL_MAX_PLUGIN_TYPE_NUM 6 /* The number of plugin types */ /* We use the following strings to define licenses for plugins */ #define PLUGIN_LICENSE_PROPRIETARY 0 @@ -650,6 +656,17 @@ struct st_mysql_information_schema int interface_version; }; +/* + API for Replication plugin. (MYSQL_REPLICATION_PLUGIN) +*/ + #define MYSQL_REPLICATION_INTERFACE_VERSION 0x0100 + + /** + Replication plugin descriptor + */ + struct Mysql_replication { + int interface_version; + }; /* st_mysql_value struct for reading values from mysqld. @@ -801,6 +818,64 @@ void mysql_query_cache_invalidate4(MYSQL_THD thd, const char *key, unsigned int key_length, int using_trx); +/** + Get the value of user variable as an integer. + + This function will return the value of variable @a name as an + integer. If the original value of the variable is not an integer, + the value will be converted into an integer. + + @param name user variable name + @param value pointer to return the value + @param null_value if not NULL, the function will set it to true if + the value of variable is null, set to false if not + + @retval 0 Success + @retval 1 Variable not found +*/ +int get_user_var_int(const char *name, + long long int *value, int *null_value); + +/** + Get the value of user variable as a double precision float number. + + This function will return the value of variable @a name as real + number. If the original value of the variable is not a real number, + the value will be converted into a real number. + + @param name user variable name + @param value pointer to return the value + @param null_value if not NULL, the function will set it to true if + the value of variable is null, set to false if not + + @retval 0 Success + @retval 1 Variable not found +*/ +int get_user_var_real(const char *name, + double *value, int *null_value); + +/** + Get the value of user variable as a string. + + This function will return the value of variable @a name as + string. If the original value of the variable is not a string, + the value will be converted into a string. + + @param name user variable name + @param value pointer to the value buffer + @param len length of the value buffer + @param precision precision of the value if it is a float number + @param null_value if not NULL, the function will set it to true if + the value of variable is null, set to false if not + + @retval 0 Success + @retval 1 Variable not found +*/ +int get_user_var_str(const char *name, + char *value, unsigned long len, + unsigned int precision, int *null_value); + + #ifdef __cplusplus } #endif diff --git a/include/mysql/plugin.h.pp b/include/mysql/plugin.h.pp index 50511f515ab..d864140333b 100644 --- a/include/mysql/plugin.h.pp +++ b/include/mysql/plugin.h.pp @@ -1,3 +1,5 @@ +#include <stdlib.h> +typedef struct st_mysql MYSQL; struct st_mysql_lex_string { char *str; @@ -105,6 +107,9 @@ struct st_mysql_information_schema { int interface_version; }; +struct Mysql_replication { + int interface_version; +}; struct st_mysql_value { int (*value_type)(struct st_mysql_value *); @@ -137,3 +142,10 @@ void thd_get_xid(const void* thd, MYSQL_XID *xid); void mysql_query_cache_invalidate4(void* thd, const char *key, unsigned int key_length, int using_trx); +int get_user_var_int(const char *name, + long long int *value, int *null_value); +int get_user_var_real(const char *name, + double *value, int *null_value); +int get_user_var_str(const char *name, + char *value, unsigned long len, + unsigned int precision, int *null_value); |