summaryrefslogtreecommitdiff
path: root/sql/sql_parse.cc
diff options
context:
space:
mode:
authorkonstantin@mysql.com <>2005-06-08 00:34:53 +0400
committerkonstantin@mysql.com <>2005-06-08 00:34:53 +0400
commit79b82323e31f164fa96aeb38726ba0868a0a1991 (patch)
tree45fafa0273fdf02d6120d49c8ab078c18fe54107 /sql/sql_parse.cc
parent620d42318bc8235342c502263e031d4a714f1c79 (diff)
downloadmariadb-git-79b82323e31f164fa96aeb38726ba0868a0a1991.tar.gz
A followup patch for Bug#7306 (limit in prepared statements):
don't evaluate subqueries during statement prepare, even if they are not correlated. With post-review fixes.
Diffstat (limited to 'sql/sql_parse.cc')
-rw-r--r--sql/sql_parse.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 7d00cfa4c98..f48bc3713e6 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5169,26 +5169,28 @@ bool
mysql_new_select(LEX *lex, bool move_down)
{
SELECT_LEX *select_lex;
- THD *thd;
+ THD *thd= lex->thd;
DBUG_ENTER("mysql_new_select");
- if (!(select_lex= new(lex->thd->mem_root) SELECT_LEX()))
+ if (!(select_lex= new (thd->mem_root) SELECT_LEX()))
DBUG_RETURN(1);
- select_lex->select_number= ++lex->thd->select_number;
+ select_lex->select_number= ++thd->select_number;
select_lex->init_query();
select_lex->init_select();
select_lex->parent_lex= lex;
+ if (thd->current_arena->is_stmt_prepare())
+ select_lex->uncacheable|= UNCACHEABLE_PREPARE;
if (move_down)
{
SELECT_LEX_UNIT *unit;
lex->subqueries= TRUE;
/* first select_lex of subselect or derived table */
- if (!(unit= new(lex->thd->mem_root) SELECT_LEX_UNIT()))
+ if (!(unit= new (thd->mem_root) SELECT_LEX_UNIT()))
DBUG_RETURN(1);
unit->init_query();
unit->init_select();
- unit->thd= lex->thd;
+ unit->thd= thd;
unit->include_down(lex->current_select);
unit->link_next= 0;
unit->link_prev= 0;
@@ -5212,7 +5214,7 @@ mysql_new_select(LEX *lex, bool move_down)
as far as we included SELECT_LEX for UNION unit should have
fake SELECT_LEX for UNION processing
*/
- if (!(fake= unit->fake_select_lex= new(lex->thd->mem_root) SELECT_LEX()))
+ if (!(fake= unit->fake_select_lex= new (thd->mem_root) SELECT_LEX()))
DBUG_RETURN(1);
fake->include_standalone(unit,
(SELECT_LEX_NODE**)&unit->fake_select_lex);