diff options
author | Sergei Golubchik <serg@mariadb.org> | 2014-10-15 12:59:13 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2014-10-15 12:59:13 +0200 |
commit | f62c12b405ba7ec80b8e2490856b83c6f5899211 (patch) | |
tree | 010605c7f145da6ea6ac14b39abc4cf700d619b1 /sql/sql_string.h | |
parent | f947f73b2b6d2bd246b81a9038224d2a85777520 (diff) | |
parent | f1afc003eefe0aafd3e070c7453d9e029d8445a8 (diff) | |
download | mariadb-git-f62c12b405ba7ec80b8e2490856b83c6f5899211.tar.gz |
Merge 10.0.14 into 10.1
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r-- | sql/sql_string.h | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h index 0b7e949392d..f6f0344e2f1 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -353,6 +353,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(); @@ -409,7 +413,7 @@ public: friend int stringcmp(const String *a,const String *b); friend String *copy_if_not_alloced(String *a,String *b,uint32 arg_length); friend class Field; - uint32 numchars(); + uint32 numchars() const; int charpos(longlong i,uint32 offset=0); int reserve(uint32 space_needed) @@ -500,7 +504,7 @@ public: str_length+= arg_length; return FALSE; } - void print(String *print); + void print(String *print) const; bool append_for_single_quote(const char *st, uint len); bool append_for_single_quote(const String *s) @@ -519,6 +523,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) @@ -532,6 +542,15 @@ public: } return TRUE; } + bool bin_eq(const String *other) const + { + return length() == other->length() && + !memcmp(ptr(), other->ptr(), length()); + } + bool eq(const String *other, CHARSET_INFO *cs) const + { + return !sortcmp(this, other, cs); + } }; |