From 38e664cf6460c4bfe586ad9d12b9f421acf48ebc Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 24 Jan 2005 17:17:19 +0200 Subject: fixed way of forward reference detection to support literal constant (BUG#8025) mysql-test/r/subselect.result: Forward reference detection mysql-test/t/subselect.test: Forward reference detection sql/item.cc: now forward reference is detected via ref_pointer_array, because some literal constants are 'fixed' just after creation sql/sql_base.cc: fill ref_pointer_array with zerows for forward reference detection. --- sql/sql_base.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'sql/sql_base.cc') diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 263c68a82b7..fc987ef09b2 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -2405,6 +2405,20 @@ int setup_fields(THD *thd, Item **ref_pointer_array, TABLE_LIST *tables, thd->allow_sum_func= allow_sum_func; thd->where="field list"; + /* + To prevent fail on forward lookup we fill it with zerows, + then if we got pointer on zero after find_item_in_list we will know + that it is forward lookup. + + There is other way to solve problem: fill array with pointers to list, + but it will be slower. + + TODO: remove it when (if) we made one list for allfields and + ref_pointer_array + */ + if (ref_pointer_array) + bzero(ref_pointer_array, sizeof(Item *) * fields.elements); + Item **ref= ref_pointer_array; while ((item= it++)) { -- cgit v1.2.1