Currently SQLCOM_CALL is handled in a huge piece of code in a switch in mysql_execute_command():
We'll introduce a new class Sql_cmd_call and move this code to Sql_cmd_call::execute.
After this change, CALL statements will be handled in the same way with other statements using Sql_cmd based implementations:
- ALTER TABLE
- ALTER SEQUENCE
- GET DIAGNOSTICS
MDEV-10591will need more data (other than LEX::sphead) to execute the query: a pointer to Sp_handler will be needed, to distinguish between calls for standalone vs package procedures. Adding a new member to LEX is not a good idea.
- All statements should eventually be refactored to use the Sql_cmd infrastructure anyway.