Commit b23af856 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-6737 Stored routines do now work with swe7: "The table mysql.proc is...

MDEV-6737 Stored routines do now work with swe7: "The table mysql.proc is missing, corrupt, or contains bad data"
Fixed the bug itself.
Also, added "SET NAMES swe7" which was forgotten in the previous commit,
so latin1 was actually tested lati1 instead of swe7 in a mistake.
Now it tests swe7.
parent fa51a223
#
# Start of 10.0 tests
#
SET NAMES swe7;
# Start of ctype_unescape.inc
SET @query=_binary'SELECT CHARSET(\'test\'),@@character_set_client,@@character_set_connection';
PREPARE stmt FROM @query;
EXECUTE stmt;
CHARSET('test') @@character_set_client @@character_set_connection
latin1 latin1 latin1
swe7 swe7 swe7
DEALLOCATE PREPARE stmt;
CREATE TABLE allbytes (a VARBINARY(10));
# Using selected bytes combinations
......@@ -73,7 +74,7 @@ CALL p1(val);
END LOOP;
CLOSE stmt;
END//
CREATE FUNCTION iswellformed(a VARBINARY(256)) RETURNS INT RETURN a=BINARY CONVERT(a USING latin1);//
CREATE FUNCTION iswellformed(a VARBINARY(256)) RETURNS INT RETURN a=BINARY CONVERT(a USING swe7);//
CREATE FUNCTION unescape(a VARBINARY(256)) RETURNS VARBINARY(256)
BEGIN
# We need to do it in a way to avoid producing new escape sequences
......
......@@ -2,6 +2,15 @@
--echo # Start of 10.0 tests
--echo #
SET NAMES swe7;
#
# Test escape sequences.
# This also covers:
# MDEV-6737 Stored routines do now work with swe7: "The table mysql.proc is missing, corrupt, or contains bad data"
# as uses stored functions actively.
#
let $ctype_unescape_combinations=selected;
--source include/ctype_unescape.inc
......
......@@ -1321,9 +1321,22 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
it's a keyword
*/
/*
Special code for swe7. It encodes the letter "E WITH ACUTE" on
the position 0x60, where backtick normally resides.
In swe7 we cannot append 0x60 using system_charset_info,
because it cannot be converted to swe7 and will be replaced to
question mark '?'. Use &my_charset_bin to avoid this.
It will prevent conversion and will append the backtick as is.
*/
CHARSET_INFO *quote_charset= q == 0x60 &&
(packet->charset()->state & MY_CS_NONASCII) &&
packet->charset()->mbmaxlen == 1 ?
&my_charset_bin : system_charset_info;
(void) packet->reserve(length*2 + 2);
quote_char= (char) q;
if (packet->append(&quote_char, 1, system_charset_info))
if (packet->append(&quote_char, 1, quote_charset))
return true;
for (name_end= name+length ; name < name_end ; name+= length)
......@@ -1340,12 +1353,12 @@ append_identifier(THD *thd, String *packet, const char *name, uint length)
if (!length)
length= 1;
if (length == 1 && chr == (uchar) quote_char &&
packet->append(&quote_char, 1, system_charset_info))
packet->append(&quote_char, 1, quote_charset))
return true;
if (packet->append(name, length, system_charset_info))
return true;
}
return packet->append(&quote_char, 1, system_charset_info);
return packet->append(&quote_char, 1, quote_charset);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment