From f094fe551a833f50fbac7092b069462a00856719 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 9 Jan 2007 23:24:56 +0300 Subject: Fixed bug#16861: User defined variable can have a wrong value if a tmp table was used. The Item::save_in_field() function is called from fill_record() to fill the new row with data while execution of the CREATE TABLE ... SELECT statement. Item::save_in_field() calls val_xxx() methods in order to get values. val_xxx() methods do not take into account the result field. Due to this Item_func_set_user_var::val_xxx() methods returns values from the original table, not from the temporary one. The save_in_field() member function is added to the Item_func_set_user_var class. It detects whether the result field should be used and properly updates the value of the user variable. sql/item_func.cc: Bug#16861: User defined variable can have a wrong value if a tmp table was used. Added the save_in_field() member function to the Item_func_set_user_var class. sql/item_func.h: Bug#16861: User defined variable can have a wrong value if a tmp table was used. Added the save_in_field() member function to the Item_func_set_user_var class. mysql-test/r/user_var.result: Extended the test case for bug#18681: User defined variable can have a wrong value if a tmp table was used. mysql-test/t/user_var.test: Extended the test case for bug#18681: User defined variable can have a wrong value if a tmp table was used. --- sql/item_func.h | 1 + 1 file changed, 1 insertion(+) (limited to 'sql/item_func.h') diff --git a/sql/item_func.h b/sql/item_func.h index c116c18bc50..68591f9c6f5 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1188,6 +1188,7 @@ public: void print(String *str); void print_as_stmt(String *str); const char *func_name() const { return "set_user_var"; } + int save_in_field(Field *field, bool no_conversions); }; -- cgit v1.2.1