Search
j0ke.net Open Build Service
>
Projects
>
internetx
:
mysql5
>
mysql-5.0.26
> mysql-5.0.26-mybug28551.patch
Sign Up
|
Log In
Username
Password
Cancel
Overview
Repositories
Revisions
Requests
Users
Advanced
Attributes
Meta
File mysql-5.0.26-mybug28551.patch of Package mysql-5.0.26
from http://mysql.bkbits.net:8080/mysql-5.0-community/?PAGE=gnupatch&REV=1.2463.213.1 needed to fix a regression instroduced by fix for mysql#25082 --- mysql-test/r/sp.result | 7 +++++++ mysql-test/t/sp.test | 14 ++++++++++++++ sql/sp.cc | 12 ++++-------- sql/sql_db.cc | 8 ++++---- 4 files changed, 29 insertions(+), 12 deletions(-) --- mysql-test/r/sp.result.orig +++ mysql-test/r/sp.result @@ -5472,4 +5472,11 @@ DATABASE() NULL DROP DATABASE mysqltest1| use test| +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| drop table t1,t2; --- mysql-test/t/sp.test.orig +++ mysql-test/t/sp.test @@ -6430,6 +6430,20 @@ use test| # +# 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| + + +# # BUG#NNNN: New bug synopsis # #--disable_warnings --- sql/sp.cc.orig +++ sql/sp.cc @@ -1874,15 +1874,11 @@ sp_use_new_db(THD *thd, LEX_STRING new_d 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) { --- sql/sql_db.cc.orig +++ sql/sql_db.cc @@ -1236,10 +1236,10 @@ bool mysql_change_db(THD *thd, const LEX { 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);