Loading mysql-test/r/type_blob.result +14 −0 Original line number Diff line number Diff line Loading @@ -807,4 +807,18 @@ set @@sql_mode='TRADITIONAL'; create table t1 (a text default ''); ERROR 42000: BLOB/TEXT column 'a' can't have a default value set @@sql_mode=''; CREATE TABLE t (c TEXT CHARSET ASCII); INSERT INTO t (c) VALUES (REPEAT('1',65537)); Warnings: Warning 1265 Data truncated for column 'c' at row 1 INSERT INTO t (c) VALUES (REPEAT('2',65536)); Warnings: Warning 1265 Data truncated for column 'c' at row 1 INSERT INTO t (c) VALUES (REPEAT('3',65535)); SELECT LENGTH(c), CHAR_LENGTH(c) FROM t; LENGTH(c) CHAR_LENGTH(c) 65535 65535 65535 65535 65535 65535 DROP TABLE t; End of 5.0 tests mysql-test/t/type_blob.test +11 −0 Original line number Diff line number Diff line Loading @@ -436,4 +436,15 @@ set @@sql_mode='TRADITIONAL'; create table t1 (a text default ''); set @@sql_mode=''; # # Bug #32282: TEXT silently truncates when value is exactly 65536 bytes # CREATE TABLE t (c TEXT CHARSET ASCII); INSERT INTO t (c) VALUES (REPEAT('1',65537)); INSERT INTO t (c) VALUES (REPEAT('2',65536)); INSERT INTO t (c) VALUES (REPEAT('3',65535)); SELECT LENGTH(c), CHAR_LENGTH(c) FROM t; DROP TABLE t; --echo End of 5.0 tests sql/sql_string.cc +4 −1 Original line number Diff line number Diff line Loading @@ -858,7 +858,7 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, with optional left padding (for binary -> UCS2 conversion) SYNOPSIS well_formed_copy_nhars() well_formed_copy_nchars() to Store result here to_length Maxinum length of "to" string to_cs Character set of "to" string Loading Loading @@ -997,8 +997,11 @@ well_formed_copy_nchars(CHARSET_INFO *to_cs, goto outp; } else { from= from_prev; break; } } *from_end_pos= from; res= to - to_start; } Loading Loading
mysql-test/r/type_blob.result +14 −0 Original line number Diff line number Diff line Loading @@ -807,4 +807,18 @@ set @@sql_mode='TRADITIONAL'; create table t1 (a text default ''); ERROR 42000: BLOB/TEXT column 'a' can't have a default value set @@sql_mode=''; CREATE TABLE t (c TEXT CHARSET ASCII); INSERT INTO t (c) VALUES (REPEAT('1',65537)); Warnings: Warning 1265 Data truncated for column 'c' at row 1 INSERT INTO t (c) VALUES (REPEAT('2',65536)); Warnings: Warning 1265 Data truncated for column 'c' at row 1 INSERT INTO t (c) VALUES (REPEAT('3',65535)); SELECT LENGTH(c), CHAR_LENGTH(c) FROM t; LENGTH(c) CHAR_LENGTH(c) 65535 65535 65535 65535 65535 65535 DROP TABLE t; End of 5.0 tests
mysql-test/t/type_blob.test +11 −0 Original line number Diff line number Diff line Loading @@ -436,4 +436,15 @@ set @@sql_mode='TRADITIONAL'; create table t1 (a text default ''); set @@sql_mode=''; # # Bug #32282: TEXT silently truncates when value is exactly 65536 bytes # CREATE TABLE t (c TEXT CHARSET ASCII); INSERT INTO t (c) VALUES (REPEAT('1',65537)); INSERT INTO t (c) VALUES (REPEAT('2',65536)); INSERT INTO t (c) VALUES (REPEAT('3',65535)); SELECT LENGTH(c), CHAR_LENGTH(c) FROM t; DROP TABLE t; --echo End of 5.0 tests
sql/sql_string.cc +4 −1 Original line number Diff line number Diff line Loading @@ -858,7 +858,7 @@ copy_and_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs, with optional left padding (for binary -> UCS2 conversion) SYNOPSIS well_formed_copy_nhars() well_formed_copy_nchars() to Store result here to_length Maxinum length of "to" string to_cs Character set of "to" string Loading Loading @@ -997,8 +997,11 @@ well_formed_copy_nchars(CHARSET_INFO *to_cs, goto outp; } else { from= from_prev; break; } } *from_end_pos= from; res= to - to_start; } Loading