diff options
author | unknown <bell@sanja.is.com.ua> | 2005-07-16 00:17:05 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2005-07-16 00:17:05 +0300 |
commit | 026903bf2c23c40e164e8e40bb6dadec1e00ba5f (patch) | |
tree | c9fb7906419e33891ffbfa8568332c41990b135d /sql/item_strfunc.cc | |
parent | 1feeb0b29f301ed21cda6f904ed57f62812927dc (diff) | |
parent | 03f1ae0b80115cfaad7b98ae12a94a839d0c66fc (diff) | |
download | mariadb-git-026903bf2c23c40e164e8e40bb6dadec1e00ba5f.tar.gz |
Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
into sanja.is.com.ua:/home/bell/mysql/bk/work-bug6-5.0
BitKeeper/etc/config:
Auto merged
sql/item.cc:
Auto merged
sql/item.h:
Auto merged
sql/item_strfunc.cc:
Auto merged
sql/item_strfunc.h:
Auto merged
sql/sql_yacc.yy:
Auto merged
mysql-test/r/sp-security.result:
merge
mysql-test/r/view.result:
merge
mysql-test/t/sp-security.test:
merge
mysql-test/t/view.test:
merge
sql/item_cmpfunc.cc:
merge
sql/sql_class.h:
merge
Diffstat (limited to 'sql/item_strfunc.cc')
-rw-r--r-- | sql/item_strfunc.cc | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 2fd0f25e699..ec30dbf8aea 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -1552,9 +1552,11 @@ Item *Item_func_sysconst::safe_charset_converter(CHARSET_INFO *tocs) uint conv_errors; String tmp, cstr, *ostr= val_str(&tmp); cstr.copy(ostr->ptr(), ostr->length(), ostr->charset(), tocs, &conv_errors); - if (conv_errors || !(conv= new Item_string(cstr.ptr(), cstr.length(), - cstr.charset(), - collation.derivation))) + if (conv_errors || + !(conv= new Item_static_string_func(fully_qualified_func_name(), + cstr.ptr(), cstr.length(), + cstr.charset(), + collation.derivation))) { return NULL; } @@ -1584,13 +1586,24 @@ String *Item_func_user::val_str(String *str) DBUG_ASSERT(fixed == 1); THD *thd=current_thd; CHARSET_INFO *cs= system_charset_info; - const char *host= thd->host_or_ip; + const char *host, *user; uint res_length; + if (is_current) + { + user= thd->priv_user; + host= thd->priv_host; + } + else + { + user= thd->user; + host= thd->host_or_ip; + } + // For system threads (e.g. replication SQL thread) user may be empty - if (!thd->user) + if (!user) return &my_empty_string; - res_length= (strlen(thd->user)+strlen(host)+2) * cs->mbmaxlen; + res_length= (strlen(user)+strlen(host)+2) * cs->mbmaxlen; if (str->alloc(res_length)) { @@ -1598,12 +1611,13 @@ String *Item_func_user::val_str(String *str) return 0; } res_length=cs->cset->snprintf(cs, (char*)str->ptr(), res_length, "%s@%s", - thd->user, host); + user, host); str->length(res_length); str->set_charset(cs); return str; } + void Item_func_soundex::fix_length_and_dec() { collation.set(args[0]->collation); |