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.

Fix for SHOW GRANTS statement.
This commit is contained in:
Alexey Botchkov
2016-01-27 12:39:27 +04:00
parent f3926cd18e
commit 552d33095a
4 changed files with 52 additions and 4 deletions

View File

@ -1869,6 +1869,29 @@ static bool mysql_test_show_create_db(Prepared_statement *stmt)
}
/**
Validate and prepare for execution SHOW GRANTS statement.
@param stmt prepared statement
@retval
FALSE success
@retval
TRUE error, error message is set in THD
*/
static bool mysql_test_show_grants(Prepared_statement *stmt)
{
DBUG_ENTER("mysql_test_show_grants");
THD *thd= stmt->thd;
List<Item> fields;
mysql_show_grants_get_fields(thd, &fields, "Grants for");
DBUG_RETURN(send_stmt_metadata(thd, stmt, &fields));
}
/**
@brief Validate and prepare for execution CREATE VIEW statement
@ -2216,6 +2239,13 @@ static bool check_prepared_statement(Prepared_statement *stmt)
DBUG_RETURN(FALSE);
}
break;
case SQLCOM_SHOW_GRANTS:
if (!(res= mysql_test_show_grants(stmt)))
{
/* Statement and field info has already been sent */
DBUG_RETURN(FALSE);
}
break;
case SQLCOM_CREATE_VIEW:
if (lex->create_view_mode == VIEW_ALTER)
{