summaryrefslogtreecommitdiff
path: root/sql/sql_prepare.cc
diff options
context:
space:
mode:
Diffstat (limited to 'sql/sql_prepare.cc')
-rw-r--r--sql/sql_prepare.cc23
1 files changed, 18 insertions, 5 deletions
diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc
index 8a627662206..4b27c502d88 100644
--- a/sql/sql_prepare.cc
+++ b/sql/sql_prepare.cc
@@ -1901,8 +1901,19 @@ static int mysql_test_show_grants(Prepared_statement *stmt)
DBUG_ENTER("mysql_test_show_grants");
THD *thd= stmt->thd;
List<Item> fields;
+ char buff[1024];
+ const char *username= NULL, *hostname= NULL, *rolename= NULL, *end;
- mysql_show_grants_get_fields(thd, &fields, STRING_WITH_LEN("Grants for"));
+ get_show_user(thd, thd->lex->grant_user, &username, &hostname, &rolename);
+
+ if (username)
+ end= strxmov(buff,"Grants for ",username,"@",hostname, NullS);
+ else if (rolename)
+ end= strxmov(buff,"Grants for ",rolename, NullS);
+ else
+ DBUG_RETURN(1);
+
+ mysql_show_grants_get_fields(thd, &fields, buff, end - buff);
DBUG_RETURN(send_stmt_metadata(thd, stmt, &fields));
}
#endif /*NO_EMBEDDED_ACCESS_CHECKS*/
@@ -1926,7 +1937,7 @@ static int mysql_test_show_slave_status(Prepared_statement *stmt)
THD *thd= stmt->thd;
List<Item> fields;
- show_master_info_get_fields(thd, &fields, 0, 0);
+ show_master_info_get_fields(thd, &fields, thd->lex->verbose, 0);
DBUG_RETURN(send_stmt_metadata(thd, stmt, &fields));
}
@@ -2466,6 +2477,7 @@ static bool check_prepared_statement(Prepared_statement *stmt)
case SQLCOM_CREATE_INDEX:
case SQLCOM_DROP_INDEX:
case SQLCOM_ROLLBACK:
+ case SQLCOM_ROLLBACK_TO_SAVEPOINT:
case SQLCOM_TRUNCATE:
case SQLCOM_DROP_VIEW:
case SQLCOM_REPAIR:
@@ -2495,6 +2507,7 @@ static bool check_prepared_statement(Prepared_statement *stmt)
case SQLCOM_GRANT:
case SQLCOM_GRANT_ROLE:
case SQLCOM_REVOKE:
+ case SQLCOM_REVOKE_ALL:
case SQLCOM_REVOKE_ROLE:
case SQLCOM_KILL:
case SQLCOM_COMPOUND:
@@ -2527,9 +2540,9 @@ static bool check_prepared_statement(Prepared_statement *stmt)
!(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)) ||
+ res= thd->prepare_explain_fields(lex->result, &field_list,
+ lex->describe, lex->analyze_stmt) ||
+ send_prep_stmt(stmt, lex->result->field_count(field_list)) ||
lex->result->send_result_set_metadata(field_list,
Protocol::SEND_EOF);
}