Commit f8aa54f1 authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV-11685: sql_mode can't be set with non-ascii connection charset

The supplied sql_mode(s) should be converted to ASCII first,
before comparing it with the sql_mode set.
parent eaf9c4b5
...@@ -4576,6 +4576,16 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061)); ...@@ -4576,6 +4576,16 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061));
CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061)) CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061))
1 1
# #
# MDEV-11685: sql_mode can't be set with non-ascii connection charset
#
SET character_set_connection=ucs2;
SET sql_mode='NO_ENGINE_SUBSTITUTION';
SELECT @@sql_mode;
@@sql_mode
NO_ENGINE_SUBSTITUTION
SET sql_mode=DEFAULT;
SET NAMES utf8;
#
# End of 5.5 tests # End of 5.5 tests
# #
# #
......
...@@ -1580,6 +1580,16 @@ ERROR HY000: Invalid utf16 character string: 'DE9899' ...@@ -1580,6 +1580,16 @@ ERROR HY000: Invalid utf16 character string: 'DE9899'
DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
ERROR HY000: Invalid utf16 character string: 'DE9899' ERROR HY000: Invalid utf16 character string: 'DE9899'
# #
# MDEV-11685: sql_mode can't be set with non-ascii connection charset
#
SET character_set_connection=utf16;
SET sql_mode='NO_ENGINE_SUBSTITUTION';
SELECT @@sql_mode;
@@sql_mode
NO_ENGINE_SUBSTITUTION
SET sql_mode=DEFAULT;
SET NAMES utf8;
#
# End of 5.5 tests # End of 5.5 tests
# #
# #
......
...@@ -1666,6 +1666,16 @@ c ...@@ -1666,6 +1666,16 @@ c
Warnings: Warnings:
Warning 1300 Invalid utf32 character string: '\xFF\xFF\x00\x00' Warning 1300 Invalid utf32 character string: '\xFF\xFF\x00\x00'
# #
# MDEV-11685: sql_mode can't be set with non-ascii connection charset
#
SET character_set_connection=utf32;
SET sql_mode='NO_ENGINE_SUBSTITUTION';
SELECT @@sql_mode;
@@sql_mode
NO_ENGINE_SUBSTITUTION
SET sql_mode=DEFAULT;
SET NAMES utf8;
#
# End of 5.5 tests # End of 5.5 tests
# #
# #
......
...@@ -816,6 +816,14 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x0001 FROM _ucs2 0x0061)); ...@@ -816,6 +816,14 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x0001 FROM _ucs2 0x0061));
SELECT CHAR_LENGTH(TRIM(BOTH 0x61 FROM _ucs2 0x0061)); SELECT CHAR_LENGTH(TRIM(BOTH 0x61 FROM _ucs2 0x0061));
SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061)); SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _ucs2 0x0061));
--echo #
--echo # MDEV-11685: sql_mode can't be set with non-ascii connection charset
--echo #
SET character_set_connection=ucs2;
SET sql_mode='NO_ENGINE_SUBSTITUTION';
SELECT @@sql_mode;
SET sql_mode=DEFAULT;
SET NAMES utf8;
--echo # --echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests
......
...@@ -795,6 +795,15 @@ DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); ...@@ -795,6 +795,15 @@ DO RPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
--error ER_INVALID_CHARACTER_STRING --error ER_INVALID_CHARACTER_STRING
DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999); DO LPAD(_utf16 0x0061 COLLATE utf16_unicode_ci, 10000, 0x0061DE989999);
--echo #
--echo # MDEV-11685: sql_mode can't be set with non-ascii connection charset
--echo #
SET character_set_connection=utf16;
SET sql_mode='NO_ENGINE_SUBSTITUTION';
SELECT @@sql_mode;
SET sql_mode=DEFAULT;
SET NAMES utf8;
--echo # --echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
......
...@@ -894,6 +894,15 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061)); ...@@ -894,6 +894,15 @@ SELECT CHAR_LENGTH(TRIM(BOTH 0x00 FROM _utf32 0x00000061));
# #
select hex(lower(cast(0xffff0000 as char character set utf32))) as c; select hex(lower(cast(0xffff0000 as char character set utf32))) as c;
--echo #
--echo # MDEV-11685: sql_mode can't be set with non-ascii connection charset
--echo #
SET character_set_connection=utf32;
SET sql_mode='NO_ENGINE_SUBSTITUTION';
SELECT @@sql_mode;
SET sql_mode=DEFAULT;
SET NAMES utf8;
--echo # --echo #
--echo # End of 5.5 tests --echo # End of 5.5 tests
--echo # --echo #
......
...@@ -1347,7 +1347,7 @@ public: ...@@ -1347,7 +1347,7 @@ public:
if (var->value->result_type() == STRING_RESULT) if (var->value->result_type() == STRING_RESULT)
{ {
if (!(res=var->value->val_str(&str))) if (!(res=var->value->val_str_ascii(&str)))
return true; return true;
else else
{ {
......
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