diff options
author | unknown <bell@sanja.is.com.ua> | 2004-06-25 11:37:43 +0300 |
---|---|---|
committer | unknown <bell@sanja.is.com.ua> | 2004-06-25 11:37:43 +0300 |
commit | e80cfbc068e7b2bec53208f7256468c9947835af (patch) | |
tree | a016857c481c106410276511c453f438f977ce44 /sql/sql_prepare.cc | |
parent | 530d46f4e3ca688301623eefbc01401c676dc79c (diff) | |
download | mariadb-git-e80cfbc068e7b2bec53208f7256468c9947835af.tar.gz |
fixed EXPLAIN behaviour with prepared statements (BUG#4271)
mysql-test/r/ps.result:
test of prepared EXPLAIN
mysql-test/t/ps.test:
fix layout and table removing of previous tests
test of prepared EXPLAIN
sql/sql_prepare.cc:
explain pave to be prepared, too
cleanup options after explain execution
sql/sql_select.cc:
removed unneed assignment
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r-- | sql/sql_prepare.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index bb5cd755139..91df364e531 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -1082,22 +1082,22 @@ static int mysql_test_select(Prepared_statement *stmt, goto err; } + thd->used_tables= 0; // Updated by setup_fields + + // JOIN::prepare calls + if (unit->prepare(thd, 0, 0)) + { + send_error(thd); + goto err_prep; + } if (lex->describe) { if (!text_protocol && send_prep_stmt(stmt, 0)) - goto err; + goto err_prep; + unit->cleanup(); } else { - thd->used_tables= 0; // Updated by setup_fields - - // JOIN::prepare calls - if (unit->prepare(thd, 0, 0)) - { - send_error(thd); - goto err_prep; - } - if (!text_protocol) { if (send_prep_stmt(stmt, lex->select_lex.item_list.elements) || @@ -1665,6 +1665,8 @@ static void reset_stmt_for_execute(Prepared_statement *stmt) for (; sl; sl= sl->next_select_in_list()) { + /* remove option which was put by mysql_explain_union() */ + sl->options&= ~SELECT_DESCRIBE; /* Copy WHERE clause pointers to avoid damaging they by optimisation */ |