Below is the list of changes that have just been committed into a local
5.0 repository of andrey. When andrey 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, 2006-08-09 12:52:30+02:00, andrey@lmy004. +3 -0
Fix for bug#11986 (SHOW CREATE PROCEDURE fails if procedure has UTF8 symbols and is not
in cache)
For the documentation:
An SP which contains non-latin1 characters when used from another connection could be
unusable.
During load, for example CALL statement (or SHOW CREATE, or ALTER), the server will
report a syntax error.
Possible is also an error about mysql.proc being corrupted. The users does not need to
update
their mysql.proc, and this errors will disappear with this patch.
DROP procedure is not affected by these problems as it actually does not load the SP
from disk if it isn't
cached.
Solved with:
Preserve the current character set of the client, of the results and the connection.
Set them temporarily for the the parsing phase to utf8, as before storage into
mysql.proc the body
is converted to utf8. If we don't do this preservation, the current user charset is
used, which could
be different than utf8 and in this case the SP renders unusable. Also we can get an
error
that mysql.proc is corrupted.
mysql-test/r/sp-error.result@stripped, 2006-08-09 12:52:24+02:00, andrey@lmy004. +15 -0
uodate result
mysql-test/t/sp-error.test@stripped, 2006-08-09 12:52:24+02:00, andrey@lmy004. +21 -0
add test for bug 11986
Use two different additional connections not to affect the current changeset of the
test.
Create a SP with body starting with a label which is all cyrillic.
On the other connection set charsets to cp1251. This should not affect the actual
loading
and compilation of the SP
sql/sp.cc@stripped, 2006-08-09 12:52:24+02:00, andrey@lmy004. +21 -0
Fix for bug#11986 (SHOW CREATE PROCEDURE fails if procedure has UTF8 symbols and is
not in cache)
Preserve the current character set of the client, of the results and the connection.
Set them temporarily for the the parsing phase to utf8, as before storage into
mysql.proc the body
is converted to utf8. If we don't do this preservation, the current user charset is
used, which could
be different than utf8 and in this case the SP renders unusable. Also we can get an
error
that mysql.proc is corrupted.
# 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: andrey
# Host: lmy004.
# Root: /work/mysql-5.0-runtime-bug11986
--- 1.107/mysql-test/r/sp-error.result 2006-08-09 12:52:40 +02:00
+++ 1.108/mysql-test/r/sp-error.result 2006-08-09 12:52:40 +02:00
@@ -1187,3 +1187,18 @@
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'IF NOT EXISTS bug14702()
BEGIN
END' at line 1
+drop procedure if exists bug11986;
+use test;
+set names utf8;
+create procedure bug11986() етикет: begin end;
+set names cp1251;
+show create procedure test.bug11986;
+Procedure sql_mode Create Procedure
+bug11986 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug11986`()
+åòèêåò: begin end
+set names utf8;
+show create procedure test.bug11986;
+Procedure sql_mode Create Procedure
+bug11986 CREATE DEFINER=`root`@`localhost` PROCEDURE `bug11986`()
+етикет: begin end
+drop procedure test.bug11986;
--- 1.107/mysql-test/t/sp-error.test 2006-08-09 12:52:40 +02:00
+++ 1.108/mysql-test/t/sp-error.test 2006-08-09 12:52:40 +02:00
@@ -1727,6 +1727,27 @@
BEGIN
END;
+#
+# BUG#11986: SHOW CREATE PROCEDURE fails if procedure has UTF8 symbols and is not in
cache
+#
+--disable_warnings
+drop procedure if exists bug11986;
+--enable_warnings
+connect (conn1,localhost,root,,);
+use test;
+set names utf8;
+create procedure bug11986() етикет: begin end;
+disconnect conn1;
+connect (conn1,localhost,root,,);
+set names cp1251;
+show create procedure test.bug11986;
+set names utf8;
+show create procedure test.bug11986;
+disconnect conn1;
+connect (conn1,localhost,root,,);
+drop procedure test.bug11986;
+disconnect conn1;
+connection default;
#
# BUG#NNNN: New bug synopsis
--- 1.115/sql/sp.cc 2006-08-09 12:52:40 +02:00
+++ 1.116/sql/sp.cc 2006-08-09 12:52:40 +02:00
@@ -410,6 +410,9 @@
ulong old_sql_mode= thd->variables.sql_mode;
ha_rows old_select_limit= thd->variables.select_limit;
sp_rcontext *old_spcont= thd->spcont;
+ CHARSET_INFO *old_character_set_client,
+ *old_collation_connection,
+ *old_character_set_results;
char definer_user_name_holder[USERNAME_LENGTH + 1];
LEX_STRING_WITH_INIT definer_user_name(definer_user_name_holder,
@@ -433,6 +436,17 @@
defstr.set_charset(system_charset_info);
+ old_character_set_client= thd->variables.character_set_client;
+ old_character_set_results= thd->variables.character_set_results;
+ old_collation_connection= thd->variables.collation_connection;
+
+ thd->variables.character_set_client=
+ thd->variables.character_set_results=
+ thd->variables.collation_connection=
+ get_charset_by_csname("utf8", MY_CS_PRIMARY, MYF(MY_WME));
+
+ thd->update_charset();
+
/*
We have to add DEFINER clause and provide proper routine characterstics in
routine definition statement that we build here to be able to use this
@@ -454,6 +468,7 @@
if ((ret= sp_use_new_db(thd, name->m_db, &old_db, 1, &dbchanged)))
goto end;
+
lex_start(thd, (uchar*)defstr.c_ptr(), defstr.length());
thd->spcont= 0;
@@ -480,6 +495,12 @@
thd->spcont= old_spcont;
thd->variables.sql_mode= old_sql_mode;
thd->variables.select_limit= old_select_limit;
+
+ thd->variables.character_set_client= old_character_set_client;
+ thd->variables.character_set_results= old_character_set_results;
+ thd->variables.collation_connection= old_collation_connection;
+ thd->update_charset();
+
thd->lex= old_lex;
return ret;
}
| Thread |
|---|
| • bk commit into 5.0 tree (andrey:1.2235) BUG#11986 | ahristov | 9 Aug |