Commit 75fc0ac4 authored by sergefp@mysql.com's avatar sergefp@mysql.com

Merge spetrunia@bk-internal.mysql.com:/home/bk/mysql-4.1

into mysql.com:/dbdata/psergey/mysql-4.1-merge-fix
parents a7147bec afd45205
...@@ -1514,6 +1514,27 @@ static bool init_param_array(Prepared_statement *stmt) ...@@ -1514,6 +1514,27 @@ static bool init_param_array(Prepared_statement *stmt)
} }
/* Init statement before execution */
static void cleanup_stmt_for_execute(Prepared_statement *stmt)
{
THD *thd= stmt->thd;
LEX *lex= stmt->lex;
SELECT_LEX *sl= lex->all_selects_list;
for (; sl; sl= sl->next_select_in_list())
{
for (TABLE_LIST *tables= (TABLE_LIST*) sl->table_list.first;
tables;
tables= tables->next)
{
if (tables->table)
tables->table->insert_values= 0;
}
}
}
/* /*
Given a query string with parameter markers, create a Prepared Statement Given a query string with parameter markers, create a Prepared Statement
from it and send PS info back to the client. from it and send PS info back to the client.
...@@ -1614,6 +1635,7 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length, ...@@ -1614,6 +1635,7 @@ int mysql_stmt_prepare(THD *thd, char *packet, uint packet_length,
if (!error) if (!error)
error= send_prepare_results(stmt, test(name)); error= send_prepare_results(stmt, test(name));
cleanup_stmt_for_execute(stmt);
/* restore to WAIT_PRIOR: QUERY_PRIOR is set inside alloc_query */ /* restore to WAIT_PRIOR: QUERY_PRIOR is set inside alloc_query */
if (!(specialflag & SPECIAL_NO_PRIOR)) if (!(specialflag & SPECIAL_NO_PRIOR))
...@@ -1904,6 +1926,7 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt, ...@@ -1904,6 +1926,7 @@ static void execute_stmt(THD *thd, Prepared_statement *stmt,
reset_stmt_params(stmt); reset_stmt_params(stmt);
close_thread_tables(thd); // to close derived tables close_thread_tables(thd); // to close derived tables
thd->set_statement(&thd->stmt_backup); thd->set_statement(&thd->stmt_backup);
cleanup_stmt_for_execute(stmt);
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
} }
......
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