From cb38411696dfa0f98bdd1d90a99f34c3d930afd5 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Nov 2005 19:06:18 +0300 Subject: Fixes bug #14569. In addition to check current db of not being NULL value it is added a check of not being empty value. When modifying SP with Admin application on win32 it does not pass curent database so sp is stored with db=null which causes a crash later on show procedure status; --- sql/sql_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 4bbca55f6ba..03abd98c944 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4099,7 +4099,7 @@ end_with_restore_list: if (!lex->sphead->m_db.str || !lex->sphead->m_db.str[0]) { - if (! thd->db) + if (!thd->db || thd->db[0] == 0) { my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); delete lex->sphead; -- cgit v1.2.1 From 1c677f8c559f244b72ff4f6f1c7528889af05f45 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 11 Nov 2005 21:01:48 +0300 Subject: Fixes bug #14569. When no db is selected as current and we do create procedure db.sp()... we changing current db temporarily and restore it when sp is created. however thd->db in this case becomes empty string rather than NULL and so all checks of thd->db == NULL will be false. So if after this we'll issue create procedure sp2()... without specifying db it will succeed and create sp with db=NULL, which causes mysqldto crash on show procedure status statement. This patch fixes the problem. mysql-test/r/sp-error.result: Result for bug #14569. mysql-test/t/sp-error.test: Test for bug #14569. sql/sql_db.cc: Fixes bug #14569. When no db is selected as current and we do create procedure db.sp()... we changing current db temporarily and restore it when sp is created. however thd->db in this case becomes empty string rather than NULL and so all checks of thd->db == NULL will be false. This patch fixes this issue. sql/sql_parse.cc: Fixes bug #14569. Reverted from initial patch to check thd->db for null values only. --- sql/sql_parse.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sql/sql_parse.cc') diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 03abd98c944..b6ff58e1215 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4099,7 +4099,7 @@ end_with_restore_list: if (!lex->sphead->m_db.str || !lex->sphead->m_db.str[0]) { - if (!thd->db || thd->db[0] == 0) + if (!thd->db) { my_message(ER_NO_DB_ERROR, ER(ER_NO_DB_ERROR), MYF(0)); delete lex->sphead; -- cgit v1.2.1