summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc16
1 files changed, 16 insertions, 0 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 878c4d2ea5f..88c2bf824c6 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -29,6 +29,16 @@
#include <ft_global.h>
+bool check_reserved_words(LEX_STRING *name)
+{
+ if (!my_strcasecmp(system_charset_info, name->str, "GLOBAL") ||
+ !my_strcasecmp(system_charset_info, name->str, "LOCAL") ||
+ !my_strcasecmp(system_charset_info, name->str, "SESSION"))
+ return TRUE;
+ return FALSE;
+}
+
+
static void my_coll_agg_error(DTCollation &c1, DTCollation &c2,
const char *fname)
{
@@ -2957,6 +2967,12 @@ Item *get_system_var(THD *thd, enum_var_type var_type, LEX_STRING name,
(uint) strlen(server_version),
system_charset_info);
+ if (name.str && component.str && check_reserved_words(&name))
+ {
+ net_printf(thd, ER_SYNTAX_ERROR);
+ return 0;
+ }
+
Item *item;
sys_var *var;
char buff[MAX_SYS_VAR_LENGTH*2+4+8], *pos;