summaryrefslogtreecommitdiff
path: root/sql/item.cc
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-03-10 00:29:02 +0300
committerunknown <evgen@moonbone.local>2007-03-10 00:29:02 +0300
commit944030aef7828911a38ed69d89709f778ca64d46 (patch)
tree641d6571416a8d494af152f6753b253f49563548 /sql/item.cc
parent1631f65dfd757282ac480fd20b3fe7b262f500c5 (diff)
downloadmariadb-git-944030aef7828911a38ed69d89709f778ca64d46.tar.gz
Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized
away. Additional fix for bug#22331. Now Item_field prints its value in the case of the const field. mysql-test/r/varbinary.result: Corrected test case after fix for bug#22331. mysql-test/r/union.result: Corrected test case after fix for bug#22331. mysql-test/r/subselect.result: Corrected test case after fix for bug#22331. mysql-test/r/func_test.result: Corrected test case after fix for bug#22331. mysql-test/r/having.result: Corrected test case after fix for bug#22331. mysql-test/r/func_regexp.result: Corrected test case after fix for bug#22331. mysql-test/r/func_str.result: Corrected test case after fix for bug#22331. mysql-test/r/func_default.result: Corrected test case after fix for bug#22331. mysql-test/r/explain.result: Corrected test case after fix for bug#22331. sql/sql_union.cc: Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized away. Cleanup of the SELECT_LEX::order_list list. sql/item.h: Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized away. Added the print() member function to the Item_field class. sql/item.cc: Bug#22331: Wrong WHERE in EXPLAIN EXTENDED when all expressions were optimized away. Added the print() member function to the Item_field class.
Diffstat (limited to 'sql/item.cc')
-rw-r--r--sql/item.cc21
1 files changed, 19 insertions, 2 deletions
diff --git a/sql/item.cc b/sql/item.cc
index c5d8a62761c..d7faa5f598e 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1758,9 +1758,10 @@ void Item_ident::print(String *str)
}
}
- if (!table_name || !field_name)
+ if (!table_name || !field_name || !field_name[0])
{
- const char *nm= field_name ? field_name : name ? name : "tmp_field";
+ const char *nm= (field_name && field_name[0]) ?
+ field_name : name ? name : "tmp_field";
append_identifier(thd, str, nm, (uint) strlen(nm));
return;
}
@@ -4900,6 +4901,22 @@ Item *Item_field::update_value_transformer(byte *select_arg)
}
+void Item_field::print(String *str)
+{
+ if (field && field->table->const_table)
+ {
+ char buff[MAX_FIELD_WIDTH];
+ String tmp(buff,sizeof(buff),str->charset());
+ field->val_str(&tmp);
+ str->append('\'');
+ str->append(tmp);
+ str->append('\'');
+ return;
+ }
+ Item_ident::print(str);
+}
+
+
Item_ref::Item_ref(Name_resolution_context *context_arg,
Item **item, const char *table_name_arg,
const char *field_name_arg,