diff options
author | Monty <monty@mariadb.org> | 2020-07-16 16:30:06 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2020-07-23 10:54:32 +0300 |
commit | 61c15ebe323d4d6f02fab86c405b2613e5784961 (patch) | |
tree | 1b8eccd555f01f8819594bbbc373aba55a2c4694 /sql/sql_string.h | |
parent | 26824581281fcb2b2251585d8081de38d561ca93 (diff) | |
download | mariadb-git-61c15ebe323d4d6f02fab86c405b2613e5784961.tar.gz |
Remove String::lex_string() and String::lex_cstring()
- Better to use 'String *' directly.
- Added String::get_value(LEX_STRING*) for the few cases where we want to
convert a String to LEX_CSTRING.
Other things:
- Use StringBuffer for some functions to avoid mallocs
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r-- | sql/sql_string.h | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h index 2d38f6d5d13..274b1d9a5df 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -222,18 +222,6 @@ public: inline bool is_empty() const { return (str_length == 0); } inline const char *ptr() const { return Ptr; } inline const char *end() const { return Ptr + str_length; } - - LEX_STRING lex_string() const - { - LEX_STRING str = { (char*) ptr(), length() }; - return str; - } - LEX_CSTRING lex_cstring() const - { - LEX_CSTRING skr = { ptr(), length() }; - return skr; - } - bool has_8bit_bytes() const { for (const char *c= ptr(), *c_end= end(); c < c_end; c++) @@ -488,6 +476,12 @@ public: if (str.Alloced_length) Alloced_length= (uint32) (str.Alloced_length - offset); } + inline LEX_CSTRING *get_value(LEX_CSTRING *res) + { + res->str= Ptr; + res->length= str_length; + return res; + } /* Take over handling of buffer from some other object */ void reset(char *ptr_arg, size_t length_arg, size_t alloced_length_arg) @@ -888,13 +882,13 @@ public: { return Binary_string::append_hex((const char*)src, srclen); } - bool append_introducer_and_hex(CHARSET_INFO *cs, const LEX_CSTRING &str) + bool append_introducer_and_hex(String *str) { return append(STRING_WITH_LEN("_")) || - append(cs->csname) || + append(str->charset()->csname) || append(STRING_WITH_LEN(" 0x")) || - append_hex(str.str, (uint32) str.length); + append_hex(str->ptr(), (uint32) str->length()); } bool append(IO_CACHE* file, uint32 arg_length) { |