From a7f9f7ae743efca9b1f405773416d19f9ebaf3c2 Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 29 Jun 2006 16:52:46 +0500 Subject: Bug#19671 mysql_list_fields returns incorrect table name for VIEWs After view onening real view db name and table name are placed into table_list->view_db & table_list->view_name. Item_field class does not handle these names properly during intialization of Send_field. The fix is to use new class 'Item_ident_for_show' which sets correct view db name and table name for Send_field. sql/item.cc: Bug#19671 mysql_list_fields returns incorrect table name for VIEWs new Item_ident_for_show class which correctly sets view db and table names for Send_field. sql/item.h: Bug#19671 mysql_list_fields returns incorrect table name for VIEWs new Item_ident_for_show class which correctly sets view db and table names for Send_field. sql/sql_show.cc: Bug#19671 mysql_list_fields returns incorrect table name for VIEWs new Item_ident_for_show is used for views tests/mysql_client_test.c: Bug#19671 mysql_list_fields returns incorrect table name for VIEWs test case --- sql/item.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'sql/item.h') diff --git a/sql/item.h b/sql/item.h index 2cadfda6895..bee24d23245 100644 --- a/sql/item.h +++ b/sql/item.h @@ -1142,6 +1142,28 @@ public: bool any_privileges); }; + +class Item_ident_for_show :public Item +{ +public: + Field *field; + const char *db_name; + const char *table_name; + + Item_ident_for_show(Field *par_field, const char *db_arg, + const char *table_name_arg) + :field(par_field), db_name(db_arg), table_name(table_name_arg) + {} + + enum Type type() const { return FIELD_ITEM; } + double val_real() { return field->val_real(); } + longlong val_int() { return field->val_int(); } + String *val_str(String *str) { return field->val_str(str); } + my_decimal *val_decimal(my_decimal *dec) { return field->val_decimal(dec); } + void make_field(Send_field *tmp_field); +}; + + class Item_equal; class COND_EQUAL; -- cgit v1.2.1