1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge with 4.0.13

BitKeeper/etc/gone:
  auto-union
BitKeeper/etc/logging_ok:
  auto-union
myisam/sort.c:
  Auto merged
mysql-test/r/group_by.result:
  Auto merged
mysql-test/r/join_outer.result:
  Auto merged
mysql-test/r/order_by.result:
  Auto merged
mysql-test/r/query_cache.result:
  Auto merged
mysql-test/r/type_blob.result:
  Auto merged
mysql-test/r/type_ranges.result:
  Auto merged
mysql-test/r/update.result:
  Auto merged
mysql-test/t/bdb-crash.test:
  Auto merged
mysql-test/t/group_by.test:
  Auto merged
mysql-test/t/join_outer.test:
  Auto merged
mysql-test/t/order_by.test:
  Auto merged
mysql-test/t/query_cache.test:
  Auto merged
mysql-test/t/type_blob.test:
  Auto merged
mysql-test/t/type_decimal.test:
  Auto merged
mysql-test/t/type_ranges.test:
  Auto merged
mysql-test/t/update.test:
  Auto merged
sql-bench/crash-me.sh:
  Auto merged
client/mysql.cc:
  Keep old code
This commit is contained in:
unknown
2003-03-26 18:37:38 +02:00
65 changed files with 674 additions and 477 deletions

View File

@ -1451,19 +1451,25 @@ String *Item_func_database::val_str(String *str)
return str;
}
// TODO: make USER() replicate properly (currently it is replicated to "")
String *Item_func_user::val_str(String *str)
{
THD *thd=current_thd;
CHARSET_INFO *cs= default_charset();
const char *host=thd->host ? thd->host : thd->ip ? thd->ip : "";
uint32 res_length=(strlen(thd->user)+strlen(host)+10) * cs->mbmaxlen;
// For system threads (e.g. replication SQL thread) user may be empty
if (!thd->user)
return &empty_string;
uint32 res_length=(strlen(thd->user)+strlen(host)+2) * cs->mbmaxlen;
if (str->alloc(res_length))
{
null_value=1;
return 0;
null_value=1;
return 0;
}
res_length=cs->snprintf(cs, (char*)str->ptr(), res_length, "%s@%s",thd->user,host);
res_length=cs->snprintf(cs, (char*)str->ptr(), res_length, "%s@%s",
thd->user, host);
str->length(res_length);
str->set_charset(cs);
return str;