List:Commits« Previous MessageNext Message »
From:kgeorge Date:May 29 2007 1:45pm
Subject:bk commit into 5.0 tree (gkodinov:1.2504) BUG#28605
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-05-29 14:45:30+03:00, gkodinov@stripped +3 -0
  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@stripped, 2007-05-29 14:45:29+03:00, gkodinov@stripped +11 -0
    Bug #28605: test case

  mysql-test/t/sp.test@stripped, 2007-05-29 14:45:29+03:00, gkodinov@stripped +20 -0
    Bug #28605: test case

  sql/item_func.cc@stripped, 2007-05-29 14:45:29+03:00, gkodinov@stripped +3 -2
    Bug #28605: fixed the string length calculation

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	gkodinov
# Host:	magare.gmz
# Root:	/home/kgeorge/mysql/work/B28605-5.0-opt

--- 1.341/sql/item_func.cc	2007-05-28 01:05:33 +03:00
+++ 1.342/sql/item_func.cc	2007-05-29 14:45:29 +03:00
@@ -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,

--- 1.227/mysql-test/r/sp.result	2007-04-28 02:14:22 +03:00
+++ 1.228/mysql-test/r/sp.result	2007-05-29 14:45:29 +03:00
@@ -6152,3 +6152,14 @@ count(*)
 3
 drop table t1,t2;
 drop function   bug27354;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE FUNCTION metered(a INT) RETURNS INT RETURN 12;
+CREATE VIEW v1 AS SELECT test.metered(a) as metered FROM t1;
+SHOW CREATE VIEW v1;
+View	Create View
+v1	CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1`
AS select `test`.`metered`(`t1`.`a`) AS `metered` from `t1`
+DROP VIEW v1;
+DROP FUNCTION metered;
+DROP TABLE t1;
+End of 5.0 tests

--- 1.218/mysql-test/t/sp.test	2007-05-02 18:59:35 +03:00
+++ 1.219/mysql-test/t/sp.test	2007-05-29 14:45:29 +03:00
@@ -7112,3 +7112,23 @@ select count(*) from t1 /* must be 3 */;
 
 drop table t1,t2;
 drop function   bug27354;
+
+#
+# Bug #28605: SHOW CREATE VIEW with views using stored_procedures no longer
+# showing SP names.
+#
+CREATE TABLE t1 (a INT); 
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE FUNCTION metered(a INT) RETURNS INT RETURN 12;
+
+CREATE VIEW v1 AS SELECT test.metered(a) as metered FROM t1;
+
+SHOW CREATE VIEW v1;
+
+DROP VIEW v1;
+DROP FUNCTION metered;
+DROP TABLE t1;
+
+
+--echo End of 5.0 tests
Thread
bk commit into 5.0 tree (gkodinov:1.2504) BUG#28605kgeorge29 May