summaryrefslogtreecommitdiff
path: root/sql/sql_string.h
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2014-09-01 20:57:32 +0400
committerAlexander Barkov <bar@mariadb.org>2014-09-01 20:57:32 +0400
commit1427e1db99ac44dedbc78e8655742a8ed9bfd755 (patch)
treea848c06ceed3a3a7a69e6ce159f92d2c3f96c5f0 /sql/sql_string.h
parent18b307a7d23fd59b4a831e3e95207e2e34f56b6e (diff)
downloadmariadb-git-1427e1db99ac44dedbc78e8655742a8ed9bfd755.tar.gz
MDEV-6661 PI() does not work well in UCS2/UTF16/UTF32 context
MDEV-6666 Malformed result for CONCAT(utf8_column, binary_string) Item_static_string_func::safe_charset_converter() and Item_hex_string::safe_charset_converter() did not handle character sets with mbminlen>1 properly, as well as did not handle conversion from binary to multi-byte well. Introducing Item::const_charset_converter(), to reuse it in a number of Item_*::safe_charset_converter().
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r--sql/sql_string.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 95c82518f9e..cc1db1d214b 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -351,6 +351,10 @@ public:
bool set_or_copy_aligned(const char *s, uint32 arg_length, CHARSET_INFO *cs);
bool copy(const char*s,uint32 arg_length, CHARSET_INFO *csfrom,
CHARSET_INFO *csto, uint *errors);
+ bool copy(const String *str, CHARSET_INFO *tocs, uint *errors)
+ {
+ return copy(str->ptr(), str->length(), str->charset(), tocs, errors);
+ }
void move(String &s)
{
free();
@@ -517,6 +521,12 @@ public:
{
return (s->alloced && Ptr >= s->Ptr && Ptr < s->Ptr + s->str_length);
}
+ uint well_formed_length() const
+ {
+ int dummy_error;
+ return charset()->cset->well_formed_len(charset(), ptr(), ptr() + length(),
+ length(), &dummy_error);
+ }
bool is_ascii() const
{
if (length() == 0)