summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorunknown <kroki@mysql.com>2006-06-30 00:21:55 +0400
committerunknown <kroki@mysql.com>2006-06-30 00:21:55 +0400
commit8368f437a79976c77ea82b953052fdb6e08a68fc (patch)
tree46289bffd3afbbaaf54de58f85d08e0690679be3 /sql/sp_head.cc
parenta4e5d04db42bf492e2dc3af1ad11bc883959f50d (diff)
downloadmariadb-git-8368f437a79976c77ea82b953052fdb6e08a68fc.tar.gz
Bug#20230: routine_definition is not null
SHOW CREATE PROCEDURE and SHOW CREATE FUNCTION are fixed as well as INFORMATION_SCHEMA.ROUTINES.ROUTINE_NAME. mysql-test/r/information_schema.result: Add result for bug#20230. mysql-test/t/information_schema.test: Add test case for bug#20230. sql/sp_head.cc: Return NULL for routine definition if the user doesn't have enough privilege to see it. sql/sql_show.cc: Make INFORMATION_SCHEMA.ROUTINES.ROUTINE_NAME NULL-able. Return NULL if the user doesn't have enough privilege to see routine definition.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc18
1 files changed, 14 insertions, 4 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index b3b99557b63..9965c48935a 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1869,8 +1869,11 @@ sp_head::show_create_procedure(THD *thd)
field_list.push_back(new Item_empty_string("Procedure", NAME_LEN));
field_list.push_back(new Item_empty_string("sql_mode", sql_mode_len));
// 1024 is for not to confuse old clients
- field_list.push_back(new Item_empty_string("Create Procedure",
- max(buffer.length(), 1024)));
+ Item_empty_string *definition=
+ new Item_empty_string("Create Procedure", max(buffer.length(),1024));
+ definition->maybe_null= TRUE;
+ field_list.push_back(definition);
+
if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS |
Protocol::SEND_EOF))
DBUG_RETURN(1);
@@ -1879,6 +1882,8 @@ sp_head::show_create_procedure(THD *thd)
protocol->store((char*) sql_mode_str, sql_mode_len, system_charset_info);
if (full_access)
protocol->store(m_defstr.str, m_defstr.length, system_charset_info);
+ else
+ protocol->store_null();
res= protocol->write();
send_eof(thd);
@@ -1934,8 +1939,11 @@ sp_head::show_create_function(THD *thd)
&sql_mode_len);
field_list.push_back(new Item_empty_string("Function",NAME_LEN));
field_list.push_back(new Item_empty_string("sql_mode", sql_mode_len));
- field_list.push_back(new Item_empty_string("Create Function",
- max(buffer.length(),1024)));
+ Item_empty_string *definition=
+ new Item_empty_string("Create Function", max(buffer.length(),1024));
+ definition->maybe_null= TRUE;
+ field_list.push_back(definition);
+
if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(1);
@@ -1944,6 +1952,8 @@ sp_head::show_create_function(THD *thd)
protocol->store((char*) sql_mode_str, sql_mode_len, system_charset_info);
if (full_access)
protocol->store(m_defstr.str, m_defstr.length, system_charset_info);
+ else
+ protocol->store_null();
res= protocol->write();
send_eof(thd);