mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
current_user() to return priv_user
This commit is contained in:
@ -267,6 +267,8 @@ public:
|
|||||||
}
|
}
|
||||||
Item_string(const char *name_par,const char *str,uint length)
|
Item_string(const char *name_par,const char *str,uint length)
|
||||||
{
|
{
|
||||||
|
if (!length)
|
||||||
|
length=strlen(str);
|
||||||
str_value.set(str,length);
|
str_value.set(str,length);
|
||||||
max_length=length;
|
max_length=length;
|
||||||
name=(char*) name_par;
|
name=(char*) name_par;
|
||||||
|
@ -291,6 +291,15 @@ Item *create_func_pow(Item* a, Item *b)
|
|||||||
return new Item_func_pow(a,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)
|
Item *create_func_quarter(Item* a)
|
||||||
{
|
{
|
||||||
return new Item_func_quarter(a);
|
return new Item_func_quarter(a);
|
||||||
@ -394,7 +403,7 @@ Item *create_func_ucase(Item* a)
|
|||||||
|
|
||||||
Item *create_func_version(void)
|
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)
|
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_period_diff(Item* a, Item *b);
|
||||||
Item *create_func_pi(void);
|
Item *create_func_pi(void);
|
||||||
Item *create_func_pow(Item* a, Item *b);
|
Item *create_func_pow(Item* a, Item *b);
|
||||||
|
Item *create_func_current_user(void);
|
||||||
Item *create_func_quarter(Item* a);
|
Item *create_func_quarter(Item* a);
|
||||||
Item *create_func_radians(Item *a);
|
Item *create_func_radians(Item *a);
|
||||||
Item *create_func_release_lock(Item* a);
|
Item *create_func_release_lock(Item* a);
|
||||||
|
@ -398,7 +398,7 @@ static SYMBOL sql_functions[] = {
|
|||||||
{ "CAST", SYM(CAST_SYM),0,0},
|
{ "CAST", SYM(CAST_SYM),0,0},
|
||||||
{ "CEIL", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)},
|
{ "CEIL", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_ceiling)},
|
||||||
{ "CEILING", 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)},
|
{ "BIT_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_bit_length)},
|
||||||
{ "CHAR_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_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)},
|
{ "CHARACTER_LENGTH", SYM(FUNC_ARG1),0,CREATE_FUNC(create_func_char_length)},
|
||||||
|
Reference in New Issue
Block a user