mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-11975: SQLCOM_PREPARE of EXPLAIN & ANALYZE statement do not return correct metadata info
Added metadate info after prepare EXPLAIN/ANALYZE.
This commit is contained in:
@ -2500,8 +2500,28 @@ static bool check_prepared_statement(Prepared_statement *stmt)
|
||||
break;
|
||||
}
|
||||
if (res == 0)
|
||||
DBUG_RETURN(stmt->is_sql_prepare() ?
|
||||
FALSE : (send_prep_stmt(stmt, 0) || thd->protocol->flush()));
|
||||
{
|
||||
if (!stmt->is_sql_prepare())
|
||||
{
|
||||
if (lex->describe || lex->analyze_stmt)
|
||||
{
|
||||
if (!lex->result &&
|
||||
!(lex->result= new (stmt->mem_root) select_send(thd)))
|
||||
DBUG_RETURN(TRUE);
|
||||
List<Item> field_list;
|
||||
thd->prepare_explain_fields(lex->result, &field_list,
|
||||
lex->describe, lex->analyze_stmt);
|
||||
res= send_prep_stmt(stmt, lex->result->field_count(field_list)) ||
|
||||
lex->result->send_result_set_metadata(field_list,
|
||||
Protocol::SEND_EOF);
|
||||
}
|
||||
else
|
||||
res= send_prep_stmt(stmt, 0);
|
||||
if (!res)
|
||||
thd->protocol->flush();
|
||||
}
|
||||
DBUG_RETURN(FALSE);
|
||||
}
|
||||
error:
|
||||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
Reference in New Issue
Block a user