Commit a29ee100 authored by unknown's avatar unknown

current_user() to return priv_user

parent 9d14d104
......@@ -267,6 +267,8 @@ public:
}
Item_string(const char *name_par,const char *str,uint length)
{
if (!length)
length=strlen(str);
str_value.set(str,length);
max_length=length;
name=(char*) name_par;
......
......@@ -291,6 +291,15 @@ Item *create_func_pow(Item* a, Item *b)
return new Item_func_pow(a,b);
}
Item *create_func_current_user()
{
THD *thd=current_thd;
Item_string *res=new Item_string("CURRENT_USER()", thd->priv_user, 0);
res->append("@", 1);
res->append((char *)thd->host_or_ip, 0);
return res;
}
Item *create_func_quarter(Item* a)
{
return new Item_func_quarter(a);
......@@ -394,7 +403,7 @@ Item *create_func_ucase(Item* a)
Item *create_func_version(void)
{
return new Item_string(NullS,server_version, (uint) strlen(server_version));
return new Item_string("VERSION()",server_version, 0);
}
Item *create_func_weekday(Item* a)
......
......@@ -68,6 +68,7 @@ Item *create_func_period_add(Item* a, Item *b);
Item *create_func_period_diff(Item* a, Item *b);
Item *create_func_pi(void);
Item *create_func_pow(Item* a, Item *b);
Item *create_func_current_user(void);
Item *create_func_quarter(Item* a);
Item *create_func_radians(Item *a);
Item *create_func_release_lock(Item* a);
......
......@@ -398,7 +398,7 @@ static SYMBOL sql_functions[] = {
{ "CAST", SYM(CAST_SYM),0,0},
{ "CEIL", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)},
{ "CEILING", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)},
{ "CURRENT_USER", SYM(USER),0,0},
{ "CURRENT_USER", SYM(FUNC_ARG0),0,CREATE_FUNC(create_func_current_user)},
{ "BIT_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_bit_length)},
{ "CHAR_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)},
{ "CHARACTER_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment