@note USER() is replicated correctly if binlog_format=ROW or (as of BUG#28086) binlog_format=MIXED, but is incorrectly replicated to '' if binlog_format=STATEMENT. */
| 1690 | if binlog_format=STATEMENT. |
| 1691 | */ |
| 1692 | bool Item_func_user::init(const char *user, const char *host) |
| 1693 | { |
| 1694 | DBUG_ASSERT(fixed == 1); |
| 1695 | |
| 1696 | // For system threads (e.g. replication SQL thread) user may be empty |
| 1697 | if (user) |
| 1698 | { |
| 1699 | const CHARSET_INFO *cs= str_value.charset(); |
| 1700 | size_t res_length= (strlen(user)+strlen(host)+2) * cs->mbmaxlen; |
| 1701 | |
| 1702 | if (str_value.alloc((uint) res_length)) |
| 1703 | { |
| 1704 | null_value=1; |
| 1705 | return TRUE; |
| 1706 | } |
| 1707 | |
| 1708 | res_length=cs->cset->snprintf(cs, (char*)str_value.ptr(), (uint) res_length, |
| 1709 | "%s@%s", user, host); |
| 1710 | str_value.length((uint) res_length); |
| 1711 | str_value.mark_as_const(); |
| 1712 | } |
| 1713 | return FALSE; |
| 1714 | } |
| 1715 | |
| 1716 | /** |
| 1717 | If alpha, map input letter to soundex code. |