summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorunknown <gluh@gluh.mysql.r18.ru>2003-11-17 21:21:36 +0400
committerunknown <gluh@gluh.mysql.r18.ru>2003-11-17 21:21:36 +0400
commit6c1a2b7fd21b1bc253d3fffa6082571e24fac104 (patch)
tree121785070fab8fad08af454596559be157ddaade /sql/sp_head.cc
parent7b4a85050b59f6148e8ab4e6f3ae92aa1427f170 (diff)
downloadmariadb-git-6c1a2b7fd21b1bc253d3fffa6082571e24fac104.tar.gz
WL#1241: SHOW PROCEDURE/FUNCTION
WL#1263: Support for the attributes COMMENT and SUID in CREATE/ALTER PROCEDURE/FUNCTION include/mysqld_error.h: Error code for 'alter procedure' mysql-test/r/sp-error.result: Test for WL#1241&WL#1263 mysql-test/r/sp.result: Test for WL#1241&WL#1263 mysql-test/t/sp-error.test: Test for WL#1241&WL#1263 mysql-test/t/sp.test: Test for WL#1241&WL#1263 sql/share/czech/errmsg.txt: Error massage for 'alter procedure' sql/share/danish/errmsg.txt: Error massage for 'alter procedure' sql/share/dutch/errmsg.txt: Error massage for 'alter procedure' sql/share/english/errmsg.txt: Error massage for 'alter procedure' sql/share/estonian/errmsg.txt: Error massage for 'alter procedure' sql/share/french/errmsg.txt: Error massage for 'alter procedure' sql/share/german/errmsg.txt: Error massage for 'alter procedure' sql/share/greek/errmsg.txt: Error massage for 'alter procedure' sql/share/hungarian/errmsg.txt: Error massage for 'alter procedure' sql/share/italian/errmsg.txt: Error massage for 'alter procedure' sql/share/japanese/errmsg.txt: Error massage for 'alter procedure' sql/share/korean/errmsg.txt: Error massage for 'alter procedure' sql/share/norwegian-ny/errmsg.txt: Error massage for 'alter procedure' sql/share/norwegian/errmsg.txt: Error massage for 'alter procedure' sql/share/polish/errmsg.txt: Error massage for 'alter procedure' sql/share/portuguese/errmsg.txt: Error massage for 'alter procedure' sql/share/romanian/errmsg.txt: Error massage for 'alter procedure' sql/share/russian/errmsg.txt: Error massage for 'alter procedure' sql/share/serbian/errmsg.txt: Error massage for 'alter procedure' sql/share/slovak/errmsg.txt: Error massage for 'alter procedure' sql/share/spanish/errmsg.txt: Error massage for 'alter procedure' sql/share/swedish/errmsg.txt: Error massage for 'alter procedure' sql/share/ukrainian/errmsg.txt: Error massage for 'alter procedure'
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc61
1 files changed, 50 insertions, 11 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 88bd299ccd5..626addf08b0 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -131,7 +131,7 @@ sp_head::sp_head()
}
void
-sp_head::init(LEX_STRING *name, LEX *lex, LEX_STRING *comment, char suid)
+sp_head::init(LEX_STRING *name, LEX *lex)
{
DBUG_ENTER("sp_head::init");
const char *dstr = (const char*)lex->buf;
@@ -141,16 +141,6 @@ sp_head::init(LEX_STRING *name, LEX *lex, LEX_STRING *comment, char suid)
m_name.str= lex->thd->strmake(name->str, name->length);
m_defstr.length= lex->end_of_query - lex->buf;
m_defstr.str= lex->thd->strmake(dstr, m_defstr.length);
-
- m_comment.length= 0;
- m_comment.str= 0;
- if (comment)
- {
- m_comment.length= comment->length;
- m_comment.str= comment->str;
- }
-
- m_suid= suid;
lex->spcont= m_pcont= new sp_pcontext();
my_init_dynamic_array(&m_instr, sizeof(sp_instr *), 16, 8);
DBUG_VOID_RETURN;
@@ -605,7 +595,56 @@ sp_head::backpatch(sp_label_t *lab)
}
}
+int
+sp_head::show_create_procedure(THD *thd)
+{
+ Protocol *protocol= thd->protocol;
+ char buff[2048];
+ String buffer(buff, sizeof(buff), system_charset_info);
+ int res;
+ List<Item> field_list;
+
+ DBUG_ENTER("sp_head::show_create_procedure");
+ DBUG_PRINT("info", ("procedure %s", m_name.str));
+
+ field_list.push_back(new Item_empty_string("Procedure",NAME_LEN));
+ // 1024 is for not to confuse old clients
+ field_list.push_back(new Item_empty_string("Create Procedure",
+ max(buffer.length(),1024)));
+ if (protocol->send_fields(&field_list, 1))
+ DBUG_RETURN(1);
+ protocol->prepare_for_resend();
+ protocol->store(m_name.str, m_name.length, system_charset_info);
+ protocol->store(m_defstr.str, m_defstr.length, system_charset_info);
+ res= protocol->write();
+ send_eof(thd);
+ DBUG_RETURN(res);
+}
+
+int
+sp_head::show_create_function(THD *thd)
+{
+ Protocol *protocol= thd->protocol;
+ char buff[2048];
+ String buffer(buff, sizeof(buff), system_charset_info);
+ int res;
+ List<Item> field_list;
+
+ DBUG_ENTER("sp_head::show_create_function");
+ DBUG_PRINT("info", ("procedure %s", m_name.str));
+ field_list.push_back(new Item_empty_string("Function",NAME_LEN));
+ field_list.push_back(new Item_empty_string("Create Function",
+ max(buffer.length(),1024)));
+ if (protocol->send_fields(&field_list, 1))
+ DBUG_RETURN(1);
+ protocol->prepare_for_resend();
+ protocol->store(m_name.str, m_name.length, system_charset_info);
+ protocol->store(m_defstr.str, m_defstr.length, system_charset_info);
+ res= protocol->write();
+ send_eof(thd);
+ DBUG_RETURN(res);
+}
// ------------------------------------------------------------------
//