diff options
author | Magne Mahre <magne.mahre@sun.com> | 2009-10-15 11:09:31 +0200 |
---|---|---|
committer | Magne Mahre <magne.mahre@sun.com> | 2009-10-15 11:09:31 +0200 |
commit | ffbe8512f87aa27efd6a22a7db474a1466d2c767 (patch) | |
tree | ed4ac71c894f778fe71e0a1f2f8a3d8d853ae830 /sql/set_var.cc | |
parent | 9b41c7532d18b04d2f430932ad916886c77fbff6 (diff) | |
download | mariadb-git-ffbe8512f87aa27efd6a22a7db474a1466d2c767.tar.gz |
Bug #38124 "general_log_file" variable silently unset when using expression
When assigning the new string value to the variable, the
Item::str_value member was used. This is not according to
the protocol. str_value is an internal member used for
temporary assignments, and is not consistently set for all
string operations. It is set for constant strings, so it would
work in these cases, but not for string functions (concat,
substr, etc.)
The correct approach is to use Item::val_str(..) to evaluate
and retrieve the string.
Backport from 6.0-codebase
6.0-codebase revno: 2617.31.17
Diffstat (limited to 'sql/set_var.cc')
-rw-r--r-- | sql/set_var.cc | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/sql/set_var.cc b/sql/set_var.cc index f5f89f48347..d9e324e3811 100644 --- a/sql/set_var.cc +++ b/sql/set_var.cc @@ -2535,9 +2535,20 @@ bool update_sys_var_str_path(THD *thd, sys_var_str *var_str, { MYSQL_QUERY_LOG *file_log; char buff[FN_REFLEN]; - char *res= 0, *old_value=(char *)(var ? var->value->str_value.ptr() : 0); + char *res= 0, *old_value= 0; bool result= 0; - uint str_length= (var ? var->value->str_value.length() : 0); + uint str_length= 0; + + if (var) + { + String str(buff, sizeof(buff), system_charset_info), *newval; + + newval= var->value->val_str(&str); + old_value= newval->c_ptr(); + str_length= strlen(old_value); + } + + switch (log_type) { case QUERY_LOG_SLOW: |