List:Commits« Previous MessageNext Message »
From:tim Date:August 7 2007 8:24am
Subject:bk commit into 5.0 tree (tsmith:1.2490)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tsmith. When tsmith 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-08-07 02:24:50-06:00, tsmith@stripped +4 -0
  Backport fix for bug 28551

  mysql-test/r/sp.result@stripped, 2007-08-07 02:24:49-06:00, tsmith@stripped +7 -0
    Backport fix for bug 28551

  mysql-test/t/sp.test@stripped, 2007-08-07 02:24:49-06:00, tsmith@stripped +12 -0
    Backport fix for bug 28551

  sql/sp.cc@stripped, 2007-08-07 02:24:49-06:00, tsmith@stripped +4 -8
    Backport fix for bug 28551

  sql/sql_db.cc@stripped, 2007-08-07 02:24:49-06:00, tsmith@stripped +4 -4
    Backport fix for bug 28551

# 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:	tsmith
# Host:	ramayana.hindu.god
# Root:	/home/tsmith/m/bk/mysql-5.0.44-sp

--- 1.136/sql/sql_db.cc	2007-04-03 05:11:32 -06:00
+++ 1.137/sql/sql_db.cc	2007-08-07 02:24:49 -06:00
@@ -1240,10 +1240,10 @@
   {
     if (force_switch)
     {
-      push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
-                          ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR));
-
-      /* Change db to NULL. */
+      /*
+        This can only happen when we restore the old db in THD after
+        execution of a routine is complete. Change db to NULL.
+      */
 
       mysql_change_db_impl(thd, NULL, 0, thd->variables.collation_server);
 

--- 1.230/mysql-test/r/sp.result	2007-06-01 16:42:02 -06:00
+++ 1.231/mysql-test/r/sp.result	2007-08-07 02:24:49 -06:00
@@ -6173,4 +6173,11 @@
 DROP VIEW v1;
 DROP FUNCTION metered;
 DROP TABLE t1;
+drop database if exists mysqltest_db1;
+create database mysqltest_db1;
+create procedure mysqltest_db1.sp_bug28551() begin end;
+call mysqltest_db1.sp_bug28551();
+show warnings;
+Level	Code	Message
+drop database mysqltest_db1;
 End of 5.0 tests

--- 1.220/mysql-test/t/sp.test	2007-06-01 16:42:03 -06:00
+++ 1.221/mysql-test/t/sp.test	2007-08-07 02:24:49 -06:00
@@ -7130,5 +7130,17 @@
 DROP FUNCTION metered;
 DROP TABLE t1;
 
+#
+# Bug#28551 "The warning 'No database selected' is reported when calling
+# stored procedures"
+#
+--disable_warnings
+drop database if exists mysqltest_db1;
+--enable_warnings
+create database mysqltest_db1;
+create procedure mysqltest_db1.sp_bug28551() begin end;
+call mysqltest_db1.sp_bug28551();
+show warnings;
+drop database mysqltest_db1;
 
 --echo End of 5.0 tests

--- 1.131/sql/sp.cc	2007-05-17 14:17:45 -06:00
+++ 1.132/sql/sp.cc	2007-08-07 02:24:49 -06:00
@@ -1873,15 +1873,11 @@
   DBUG_PRINT("enter", ("newdb: %s", new_db.str));
 
   /*
-    Set new_db to an empty string if it's NULL, because mysql_change_db
-    requires a non-NULL argument.
-    new_db.str can be NULL only if we're restoring the old database after
-    execution of a stored procedure and there were no current database
-    selected. The stored procedure itself must always have its database
-    initialized.
+    A stored routine always belongs to some database. The
+    old database (old_db) might be NULL, but to restore the
+    old database we will use mysql_change_db.
   */
-  if (new_db.str == NULL)
-    new_db.str= empty_c_string;
+  DBUG_ASSERT(new_db.str && new_db.length);
 
   if (thd->db)
   {
Thread
bk commit into 5.0 tree (tsmith:1.2490)tim7 Aug