summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorunknown <bar@mysql.com>2007-01-24 16:37:38 +0400
committerunknown <bar@mysql.com>2007-01-24 16:37:38 +0400
commitfb33da5f569bd3fac9d658ba5eaaeeab285c7085 (patch)
tree836889e34e664088431d01c58c6b203bd2dfcc5a /sql/field.cc
parent501bf6de184d073f6dea6bd2b5bdc6247499b4e3 (diff)
downloadmariadb-git-fb33da5f569bd3fac9d658ba5eaaeeab285c7085.tar.gz
Bug#25815 Data truncated for column TEXT
Problem: "Data truncated" warning was incorrectly generated when storing a Japanese character encoded in utf8 into a cp932 column. Reason: Incorrect wrong warning condition compared the original length of the character in bytes (which is 3 in utf8) to the converted length of the character in bytes (which is 2 in cp932). Fix: use "how many bytes were scanned from input" instead of "how many bytes were put to the column" in the condition. mysql-test/r/ctype_cp932.result: Adding test case mysql-test/t/ctype_cp932.test: Adding test case sql/field.cc: Change warning condition from: "if number of bytes written to destination is less than full source length" to "if number of bytes read from source is less than full source length"
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 257c7846468..61a687567fc 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -7024,7 +7024,7 @@ int Field_blob::store(const char *from,uint length,CHARSET_INFO *cs)
cannot_convert_error_pos, from + length))
return 2;
- if (copy_length < length)
+ if (from_end_pos < from + length)
{
report_data_too_long(this);
return 2;