summaryrefslogtreecommitdiff
path: root/sql/sql_acl.cc
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@askmonty.org>2016-01-27 12:39:27 +0400
committerAlexey Botchkov <holyfoot@askmonty.org>2016-01-28 11:12:03 +0400
commit552d33095a25f6e1f9af802e71713b0bec0f6acb (patch)
treebd23fc46ae9325ae37fe2366c587cd842a48713b /sql/sql_acl.cc
parentf3926cd18e2ba64f2643c6c4f6a981ed99868895 (diff)
downloadmariadb-git-552d33095a25f6e1f9af802e71713b0bec0f6acb.tar.gz
MDEV-5273 Prepared statement doesn't return metadata after prepare.
Fix for SHOW GRANTS statement.
Diffstat (limited to 'sql/sql_acl.cc')
-rw-r--r--sql/sql_acl.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc
index c6793241f70..e5a80420470 100644
--- a/sql/sql_acl.cc
+++ b/sql/sql_acl.cc
@@ -7740,6 +7740,16 @@ static int show_grants_callback(ACL_USER_BASE *role, void *data)
}
+void mysql_show_grants_get_fields(THD *thd, List<Item> *fields,
+ const char *name)
+{
+ Item_string *field=new (thd->mem_root) Item_string_ascii(thd, "", 0);
+ field->name= (char *) name;
+ field->max_length=1024;
+ fields->push_back(field, thd->mem_root);
+}
+
+
/*
SHOW GRANTS; Send grants for a user to the client
@@ -7805,15 +7815,14 @@ bool mysql_show_grants(THD *thd, LEX_USER *lex_user)
}
DBUG_ASSERT(rolename || username);
- Item_string *field=new (thd->mem_root) Item_string_ascii(thd, "", 0);
List<Item> field_list;
- field->name=buff;
- field->max_length=1024;
if (!username)
strxmov(buff,"Grants for ",rolename, NullS);
else
strxmov(buff,"Grants for ",username,"@",hostname, NullS);
- field_list.push_back(field, thd->mem_root);
+
+ mysql_show_grants_get_fields(thd, &field_list, buff);
+
if (protocol->send_result_set_metadata(&field_list,
Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF))