Hi Guilhem, Gleb,
A couple of comments on Guilhem's comments first.
>> + This method:
>> + a) allocates a select_send object (if no one pre-allocated available),
>> + b) calculates and sends whole EXPLAIN data.
>> +
>> + @returns
>> + @retval FALSE Ok
>> + @retval TRUE Error
>
> GB39 nowadays the coding style allows true/false too, it's up to you.
My preferred Doxygen documentation for return values is
@return false if successful, true if error
This is so common, and saves two lines without loss of information.
>
> GB75 this code above resembles what is done in execute_sqlcom_select() (if
> lex->describe is true), which is:
>
> thd->send_explain_fields(result);
> res= mysql_explain_union(thd, &thd->lex->unit, result);
> ...
> if (res)
> result->abort_result_set();
> else
> result->send_eof();
> Can we make execute_sqlcom_select() call explain_data_modification(), to
> avoid duplication?
> The creation of the warning (of EXPLAIN EXTENDED) can also move into
> explain_data_modification().
If this is done, explain_data_modification() must be renamed as a SELECT is not
a data modification. My suggestion in that case would be
explain_query_specification() (Query specification is the term used in the SQL
standard for a SELECT block).
Thank,
Roy