summaryrefslogtreecommitdiff
path: root/sql/field.h
diff options
context:
space:
mode:
authorSergey Vojtovich <svoj@mariadb.org>2018-04-25 14:42:38 +0400
committerSergey Vojtovich <svoj@mariadb.org>2018-04-30 19:34:08 +0400
commit68cbabbfb0667187042315461069d3e1aeb2c57b (patch)
tree72d7eed804e1aa5e8206694049be33b0c56c42c8 /sql/field.h
parent9a8498066865b508239b36853403f2700800af2b (diff)
downloadmariadb-git-68cbabbfb0667187042315461069d3e1aeb2c57b.tar.gz
MDEV-15938 - TINYTEXT CHARACTER SET utf8 COMPRESSED truncates data
Unexpected data truncation may occur when storing data to compressed blob column having multi byte variable length character sets. The reason was incorrect number of characters limit was enforced for blobs.
Diffstat (limited to 'sql/field.h')
-rw-r--r--sql/field.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/sql/field.h b/sql/field.h
index e7ec0b681e2..50ee5b7784d 100644
--- a/sql/field.h
+++ b/sql/field.h
@@ -1772,13 +1772,27 @@ protected:
return report_if_important_data(copier->source_end_pos(),
end, count_spaces);
}
+ int well_formed_copy_with_check(char *to, size_t to_length,
+ CHARSET_INFO *from_cs,
+ const char *from, size_t from_length,
+ size_t nchars, bool count_spaces,
+ uint *copy_length)
+ {
+ String_copier copier;
+
+ *copy_length= copier.well_formed_copy(field_charset, to, to_length,
+ from_cs, from, from_length,
+ nchars);
+
+ return check_conversion_status(&copier, from + from_length, from_cs, count_spaces);
+ }
bool cmp_to_string_with_same_collation(const Item_bool_func *cond,
const Item *item) const;
bool cmp_to_string_with_stricter_collation(const Item_bool_func *cond,
const Item *item) const;
int compress(char *to, uint *to_length,
const char *from, uint length,
- CHARSET_INFO *cs);
+ CHARSET_INFO *cs, size_t nchars);
String *uncompress(String *val_buffer, String *val_ptr,
const uchar *from, uint from_length);
public: