summaryrefslogtreecommitdiff
path: root/sql/item_subselect.cc
diff options
context:
space:
mode:
authorunknown <bell@sanja.is.com.ua>2002-11-24 21:10:52 +0200
committerunknown <bell@sanja.is.com.ua>2002-11-24 21:10:52 +0200
commit06e647472fada2a3b857121ecd947372a5322d77 (patch)
tree44682d84835ae5313d9289b2e733e4c83503334b /sql/item_subselect.cc
parent83e25bbc3090982c31a064b1b2cd78b710c37207 (diff)
downloadmariadb-git-06e647472fada2a3b857121ecd947372a5322d77.tar.gz
Reference to field in outer subelect fixed
Fixed context in error mesages mysql-test/r/subselect.result: tests of references and error message mysql-test/t/subselect.test: tests of references and error message sql/item.cc: Fixed layout Resolving field names of outer select sql/item_subselect.cc: saving/restoring context for error messages sql/mysql_priv.h: changed function interface to allow resolving field names inside Item_ref::fix_fields sql/sql_base.cc: changed function interface to allow resolving field names inside Item_ref::fix_fields sql/sql_lex.h: allow access to thd field
Diffstat (limited to 'sql/item_subselect.cc')
-rw-r--r--sql/item_subselect.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc
index 01ce5fad4a6..7650ecc01c0 100644
--- a/sql/item_subselect.cc
+++ b/sql/item_subselect.cc
@@ -81,6 +81,7 @@ void Item_subselect::make_field (Send_field *tmp_field)
bool Item_subselect::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
{
+ char const *save_where= thd->where;
int res= engine->prepare();
if (!res)
{
@@ -93,6 +94,7 @@ bool Item_subselect::fix_fields(THD *thd, TABLE_LIST *tables, Item **ref)
fix_length_and_dec();
}
fixed= 1;
+ thd->where= save_where;
return res;
}
@@ -312,11 +314,13 @@ void subselect_union_engine::fix_length_and_dec()
int subselect_single_select_engine::exec()
{
DBUG_ENTER("subselect_single_select_engine::exec");
+ char const *save_where= join->thd->where;
if (!optimized)
{
optimized=1;
if (join->optimize())
{
+ join->thd->where= save_where;
executed= 1;
DBUG_RETURN(join->error?join->error:1);
}
@@ -324,7 +328,10 @@ int subselect_single_select_engine::exec()
if (select_lex->dependent && executed)
{
if (join->reinit())
+ {
+ join->thd->where= save_where;
DBUG_RETURN(1);
+ }
item->assign_null();
item->assigned((executed= 0));
}
@@ -335,14 +342,19 @@ int subselect_single_select_engine::exec()
join->exec();
join->thd->lex.current_select= save_select;
executed= 1;
+ join->thd->where= save_where;
DBUG_RETURN(join->error||thd->fatal_error);
}
+ join->thd->where= save_where;
DBUG_RETURN(0);
}
int subselect_union_engine::exec()
{
- return unit->exec();
+ char const *save_where= unit->thd->where;
+ int res= unit->exec();
+ unit->thd->where= save_where;
+ return res;
}
uint subselect_single_select_engine::cols()