1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-5273 Prepared statement doesn't return metadata after prepare.

SHOW CREATE PROCEDURE/FUNCTION fixed.
This commit is contained in:
Alexey Botchkov
2016-01-27 14:58:52 +04:00
parent 34df3140f2
commit d16d40be2c
4 changed files with 117 additions and 0 deletions

View File

@ -1963,6 +1963,29 @@ static bool mysql_test_show_binlogs(Prepared_statement *stmt)
}
/**
Validate and prepare for execution SHOW CREATE PROC/FUNC statement.
@param stmt prepared statement
@retval
FALSE success
@retval
TRUE error, error message is set in THD
*/
static bool mysql_test_show_create_routine(Prepared_statement *stmt, int type)
{
DBUG_ENTER("mysql_test_show_binlogs");
THD *thd= stmt->thd;
List<Item> fields;
sp_head::show_create_routine_get_fields(thd, type, &fields);
DBUG_RETURN(send_stmt_metadata(thd, stmt, &fields));
}
/**
@brief Validate and prepare for execution CREATE VIEW statement
@ -2338,6 +2361,20 @@ static bool check_prepared_statement(Prepared_statement *stmt)
DBUG_RETURN(FALSE);
}
break;
case SQLCOM_SHOW_CREATE_PROC:
if (!(res= mysql_test_show_create_routine(stmt, TYPE_ENUM_PROCEDURE)))
{
/* Statement and field info has already been sent */
DBUG_RETURN(FALSE);
}
break;
case SQLCOM_SHOW_CREATE_FUNC:
if (!(res= mysql_test_show_create_routine(stmt, TYPE_ENUM_FUNCTION)))
{
/* Statement and field info has already been sent */
DBUG_RETURN(FALSE);
}
break;
case SQLCOM_CREATE_VIEW:
if (lex->create_view_mode == VIEW_ALTER)
{