From e28a241907aa7a511b65b196703efaeea71e1dc4 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 18 Mar 2015 17:10:48 +0400 Subject: MDEV-7661 Unexpected result for: CAST(0xHHHH AS CHAR CHARACTER SET xxx) for incorrect byte sequences --- sql/sql_string.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'sql/sql_string.h') diff --git a/sql/sql_string.h b/sql/sql_string.h index 4a23d65d6a8..518b8e5ba4b 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -200,6 +200,7 @@ public: inline bool is_empty() const { return (str_length == 0); } inline void mark_as_const() { Alloced_length= 0;} inline const char *ptr() const { return Ptr; } + inline const char *end() const { return Ptr + str_length; } inline char *c_ptr() { DBUG_ASSERT(!alloced || !Ptr || !Alloced_length || @@ -423,6 +424,17 @@ public: { return copy(str->ptr(), str->length(), str->charset(), tocs, errors); } + bool copy(CHARSET_INFO *tocs, + CHARSET_INFO *fromcs, const char *src, uint32 src_length, + uint32 nchars, String_copier *copier) + { + if (alloc(tocs->mbmaxlen * src_length)) + return true; + str_length= copier->well_formed_copy(tocs, Ptr, Alloced_length, + fromcs, src, src_length, nchars); + str_charset= tocs; + return false; + } void move(String &s) { free(); -- cgit v1.2.1