Commit fd427c06 authored by unknown's avatar unknown

Fic for Bug 2367: INSERT() behaviour is different for different charsets.

parent 4239d4b2
...@@ -173,6 +173,12 @@ SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F'; ...@@ -173,6 +173,12 @@ SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
word word
cat cat
DROP TABLE t1; DROP TABLE t1;
select insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066);
insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066)
abc
select insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066);
insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066)
defc
SET NAMES latin1; SET NAMES latin1;
CREATE TABLE t1 ( CREATE TABLE t1 (
word VARCHAR(64), word VARCHAR(64),
......
...@@ -62,3 +62,9 @@ select 'A' like 'a' collate utf8_bin; ...@@ -62,3 +62,9 @@ select 'A' like 'a' collate utf8_bin;
select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%'); select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
_utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%') _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%')
1 1
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
insert('txs',2,1,'hi') insert('is ',4,0,'a') insert('txxxxt',2,4,'es')
this is a test
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
insert("aa",100,1,"b") insert("aa",1,3,"b")
aa b
...@@ -93,6 +93,12 @@ SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025'; ...@@ -93,6 +93,12 @@ SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630025';
SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F'; SELECT * FROM t1 WHERE word LIKE _ucs2 x'00630061005F';
DROP TABLE t1; DROP TABLE t1;
#
# Check that INSERT works fine.
# This invokes charpos() function.
select insert(_ucs2 0x006100620063,10,2,_ucs2 0x006400650066);
select insert(_ucs2 0x006100620063,1,2,_ucs2 0x006400650066);
###################################################### ######################################################
# #
...@@ -191,4 +197,3 @@ DROP TABLE t1; ...@@ -191,4 +197,3 @@ DROP TABLE t1;
# END OF Bug 1264 test # END OF Bug 1264 test
# #
######################################################## ########################################################
...@@ -35,3 +35,9 @@ select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%'); ...@@ -35,3 +35,9 @@ select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD0B1,_utf8 '%');
# #
#select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD091,_utf8 '%'); #select _utf8 0xD0B0D0B1D0B2 like concat(_utf8'%',_utf8 0xD091,_utf8 '%');
# #
#
# Bug 2367: INSERT() behaviour is different for different charsets.
#
select insert('txs',2,1,'hi'),insert('is ',4,0,'a'),insert('txxxxt',2,4,'es');
select insert("aa",100,1,"b"),insert("aa",1,3,"b");
...@@ -271,7 +271,7 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)), ...@@ -271,7 +271,7 @@ uint my_charpos_mb(CHARSET_INFO *cs __attribute__((unused)),
b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1; b+= (mblen= my_ismbchar(cs,b,e)) ? mblen : 1;
pos--; pos--;
} }
return b-b0; return pos ? e+2-b0 : b-b0;
} }
uint my_instr_mb(CHARSET_INFO *cs, uint my_instr_mb(CHARSET_INFO *cs,
......
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