Commit 23865c0e authored by unknown's avatar unknown

Merge work:/home/bk/mysql-4.0

into serg.mysql.com:/usr/home/serg/Abk/mysql-4.0

parents 9b5167ee a29ee100
......@@ -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;
......@@ -286,7 +288,7 @@ public:
String *const_string() { return &str_value; }
inline void append(char *str,uint length) { str_value.append(str,length); }
void print(String *str);
unsigned int size_of() { return sizeof(*this);}
unsigned int size_of() { return sizeof(*this);}
};
......
......@@ -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