From ffbe8512f87aa27efd6a22a7db474a1466d2c767 Mon Sep 17 00:00:00 2001 From: Magne Mahre Date: Thu, 15 Oct 2009 11:09:31 +0200 Subject: 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 --- mysql-test/r/log_state.result | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'mysql-test/r/log_state.result') diff --git a/mysql-test/r/log_state.result b/mysql-test/r/log_state.result index 5c3e3d789a1..56e30ac59f8 100644 --- a/mysql-test/r/log_state.result +++ b/mysql-test/r/log_state.result @@ -309,6 +309,30 @@ SET @@global.general_log_file = @old_general_log_file; SET @@global.slow_query_log = @old_slow_query_log; SET @@global.slow_query_log_file = @old_slow_query_log_file; End of 5.1 tests + +# -- +# -- Bug#38124: "general_log_file" variable silently unset when +# -- using expression +# -- +SET GLOBAL general_log_file = DEFAULT; +SELECT @@general_log_file INTO @my_glf; +SET GLOBAL general_log_file = 'BUG38124.LOG'; +SELECT @@general_log_file; +@@general_log_file +BUG38124.LOG +SET GLOBAL general_log_file = concat('BUG38124-2.LOG'); +SELECT @@general_log_file; +@@general_log_file +BUG38124-2.LOG +SET GLOBAL general_log_file = substr('BUG38124-2.LOG',3,6); +SELECT @@general_log_file; +@@general_log_file +G38124 +SET GLOBAL general_log_file = DEFAULT; +SELECT @@general_log_file = @my_glf; +@@general_log_file = @my_glf +1 +SET GLOBAL general_log_file = @old_general_log_file; # Close connection con1 SET global general_log = @old_general_log; SET global general_log_file = @old_general_log_file; -- cgit v1.2.1