summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authoranozdrin@mysql.com <>2006-03-02 15:18:49 +0300
committeranozdrin@mysql.com <>2006-03-02 15:18:49 +0300
commitfbb59203995255042356ba0fbd681e5afd7ac607 (patch)
tree6152000814e1f8e657b10e3aacb0ef3bcf8d7f11 /sql/sp_head.cc
parent302239f388d0bf28ccbb3a234463f7fdd25da717 (diff)
downloadmariadb-git-fbb59203995255042356ba0fbd681e5afd7ac607.tar.gz
Implementation of WL#2897: Complete definer support in the stored routines.
The idea is to add DEFINER-clause in CREATE PROCEDURE and CREATE FUNCTION statements. Almost all support of definer in stored routines had been already done before this patch. NOTE: this patch changes behaviour of dumping stored routines in mysqldump. Before this patch, mysqldump did not dump DEFINER-clause for stored routines and this was documented behaviour. In order to get full information about stored routines, one should have dumped mysql.proc table. This patch changes this behaviour, so that DEFINER-clause is dumped. Since DEFINER-clause is not supported in CREATE PROCEDURE | FUNCTION statements before this patch, the clause is covered by additional version-specific comments.
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc28
1 files changed, 18 insertions, 10 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index f7572a374f1..b8b7ee2f78b 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -1810,19 +1810,27 @@ sp_head::set_info(longlong created, longlong modified,
void
sp_head::set_definer(const char *definer, uint definerlen)
{
- uint user_name_len;
- char user_name_str[USERNAME_LENGTH + 1];
- uint host_name_len;
- char host_name_str[HOSTNAME_LENGTH + 1];
+ char user_name_holder[USERNAME_LENGTH + 1];
+ LEX_STRING_WITH_INIT user_name(user_name_holder, USERNAME_LENGTH);
- parse_user(definer, definerlen, user_name_str, &user_name_len,
- host_name_str, &host_name_len);
+ char host_name_holder[HOSTNAME_LENGTH + 1];
+ LEX_STRING_WITH_INIT host_name(host_name_holder, HOSTNAME_LENGTH);
- m_definer_user.str= strmake_root(mem_root, user_name_str, user_name_len);
- m_definer_user.length= user_name_len;
+ parse_user(definer, definerlen, user_name.str, &user_name.length,
+ host_name.str, &host_name.length);
- m_definer_host.str= strmake_root(mem_root, host_name_str, host_name_len);
- m_definer_host.length= host_name_len;
+ set_definer(&user_name, &host_name);
+}
+
+
+void
+sp_head::set_definer(const LEX_STRING *user_name, const LEX_STRING *host_name)
+{
+ m_definer_user.str= strmake_root(mem_root, user_name->str, user_name->length);
+ m_definer_user.length= user_name->length;
+
+ m_definer_host.str= strmake_root(mem_root, host_name->str, host_name->length);
+ m_definer_host.length= host_name->length;
}