Commit defa3d48 authored by bell@sanja.is.com.ua's avatar bell@sanja.is.com.ua

fixed unlinking SELECT methods

parent 4da4fdbf
......@@ -1112,8 +1112,11 @@ void st_select_lex_unit::exclude_level()
SELECT_LEX_UNIT *units= 0, **units_last= &units;
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
{
// unlink current level from global SELECTs list
if (sl->link_prev && (*sl->link_prev= sl->link_next))
sl->link_next->link_prev= sl->link_prev;
// bring up underlay levels
SELECT_LEX_UNIT **last= 0;
for (SELECT_LEX_UNIT *u= sl->first_inner_unit(); u; u= u->next_unit())
{
......@@ -1128,11 +1131,20 @@ void st_select_lex_unit::exclude_level()
}
if (units)
{
// include brought up levels in place of current
(*prev)= units;
(*units_last)= (SELECT_LEX_UNIT*)next;
if (next)
next->prev= (SELECT_LEX_NODE**)units_last;
units->prev= prev;
}
else
{
// exclude currect unit from list of nodes
(*prev)= next;
if (next)
next->prev= prev;
}
}
......@@ -1147,15 +1159,20 @@ void st_select_lex_unit::exclude_tree()
SELECT_LEX_UNIT *units= 0, **units_last= &units;
for (SELECT_LEX *sl= first_select(); sl; sl= sl->next_select())
{
// unlink current level from global SELECTs list
if (sl->link_prev && (*sl->link_prev= sl->link_next))
sl->link_next->link_prev= sl->link_prev;
// unlink underlay levels
for (SELECT_LEX_UNIT *u= sl->first_inner_unit(); u; u= u->next_unit())
{
u->exclude_level();
}
}
// exclude currect unit from list of nodes
(*prev)= next;
if (next)
next->prev= prev;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment