summaryrefslogtreecommitdiff
path: root/sql/item_strfunc.h
diff options
context:
space:
mode:
authorunknown <kroki@mysql.com>2006-07-04 23:55:52 +0400
committerunknown <kroki@mysql.com>2006-07-04 23:55:52 +0400
commit2a5fa3cf0c982b0c0a6e281fb8c06211491e9f99 (patch)
tree717bee0a5cad4ad746ed8a1a22d731b5edfd8d71 /sql/item_strfunc.h
parent6a8f2ee2931342d40576736c2286352f0c654c33 (diff)
parenta2fc4843e38fcf12cacd526f1227cc0b30488bb5 (diff)
downloadmariadb-git-2a5fa3cf0c982b0c0a6e281fb8c06211491e9f99.tar.gz
Merge mysql.com:/home/tomash/src/mysql_ab/mysql-5.0
into mysql.com:/home/tomash/src/mysql_ab/mysql-5.0-bug20570 sql/item_strfunc.cc: Auto merged sql/item_strfunc.h: Auto merged sql/sql_yacc.yy: Auto merged mysql-test/r/view_grant.result: Manual merge. mysql-test/t/view_grant.test: Manual merge.
Diffstat (limited to 'sql/item_strfunc.h')
-rw-r--r--sql/item_strfunc.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h
index af59b8d740b..a2204f22822 100644
--- a/sql/item_strfunc.h
+++ b/sql/item_strfunc.h
@@ -385,21 +385,40 @@ public:
class Item_func_user :public Item_func_sysconst
{
- bool is_current;
+protected:
+ bool init (const char *user, const char *host);
public:
- Item_func_user(bool is_current_arg)
- :Item_func_sysconst(), is_current(is_current_arg) {}
- String *val_str(String *);
+ Item_func_user()
+ {
+ str_value.set("", 0, system_charset_info);
+ }
+ String *val_str(String *)
+ {
+ DBUG_ASSERT(fixed == 1);
+ return (null_value ? 0 : &str_value);
+ }
+ bool fix_fields(THD *thd, Item **ref);
void fix_length_and_dec()
{
max_length= ((USERNAME_LENGTH + HOSTNAME_LENGTH + 1) *
system_charset_info->mbmaxlen);
}
- const char *func_name() const
- { return is_current ? "current_user" : "user"; }
- const char *fully_qualified_func_name() const
- { return is_current ? "current_user()" : "user()"; }
+ const char *func_name() const { return "user"; }
+ const char *fully_qualified_func_name() const { return "user()"; }
+};
+
+
+class Item_func_current_user :public Item_func_user
+{
+ Name_resolution_context *context;
+
+public:
+ Item_func_current_user(Name_resolution_context *context_arg)
+ : context(context_arg) {}
+ bool fix_fields(THD *thd, Item **ref);
+ const char *func_name() const { return "current_user"; }
+ const char *fully_qualified_func_name() const { return "current_user()"; }
};