summaryrefslogtreecommitdiff
path: root/sql/item_func.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-05-29 14:45:30 +0300
committerunknown <gkodinov/kgeorge@magare.gmz>2007-05-29 14:45:30 +0300
commit9e06efb45c1a2ce808d642c020c4783d7fc1b1d8 (patch)
treeb2f7c17aadb9dbe47a640687052eafd91cc69b75 /sql/item_func.cc
parentd7a90fa1724a047d8b9cf81e974c39a9ae64ff84 (diff)
downloadmariadb-git-9e06efb45c1a2ce808d642c020c4783d7fc1b1d8.tar.gz
Bug #28605: SHOW CREATE VIEW with views using stored_procedures no
longer showing SP names. SHOW CREATE VIEW uses Item::print() methods to reconstruct the statement text from the parse tree. The print() method for stored procedure calls needs allocate space to print the function's quoted name. It was incorrectly calculating the length of the buffer needed (was too short). Fixed to reflect the actual space needed. mysql-test/r/sp.result: Bug #28605: test case mysql-test/t/sp.test: Bug #28605: test case sql/item_func.cc: Bug #28605: fixed the string length calculation
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r--sql/item_func.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc
index 34f3c2c6add..7e1872e9a75 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -5213,10 +5213,11 @@ Item_func_sp::func_name() const
{
THD *thd= current_thd;
/* Calculate length to avoid reallocation of string for sure */
- uint len= ((m_name->m_explicit_name ? m_name->m_db.length : 0 +
+ uint len= (((m_name->m_explicit_name ? m_name->m_db.length : 0) +
m_name->m_name.length)*2 + //characters*quoting
2 + // ` and `
- 1 + // .
+ (m_name->m_explicit_name ?
+ 3 : 0) + // '`', '`' and '.' for the db
1 + // end of string
ALIGN_SIZE(1)); // to avoid String reallocation
String qname((char *)alloc_root(thd->mem_root, len), len,