diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2013-02-12 08:20:14 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2013-02-12 08:20:14 +0400 |
commit | 18fec5128b6fd9712f63e306f03f16833f2599b2 (patch) | |
tree | d4f4f4428c6402146c05244504c63ad9a0b14989 /sql/sql_string.h | |
parent | a555ceb2fb75c9958e39c963ca2a83e615629711 (diff) | |
download | mariadb-git-18fec5128b6fd9712f63e306f03f16833f2599b2.tar.gz |
EXPLAIN DELETE for MariaDB
- Backported the code to 10.0-base
- Removed incorrect assert
Diffstat (limited to 'sql/sql_string.h')
-rw-r--r-- | sql/sql_string.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/sql_string.h b/sql/sql_string.h index 58cda343dac..e08b7a2581f 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -500,6 +500,38 @@ public: } }; + +// The following class is a backport from MySQL 5.6: +/** + String class wrapper with a preallocated buffer of size buff_sz + + This class allows to replace sequences of: + char buff[12345]; + String str(buff, sizeof(buff)); + str.length(0); + with a simple equivalent declaration: + StringBuffer<12345> str; +*/ + +template<size_t buff_sz> +class StringBuffer : public String +{ + char buff[buff_sz]; + +public: + StringBuffer() : String(buff, buff_sz, &my_charset_bin) { length(0); } + explicit StringBuffer(const CHARSET_INFO *cs) : String(buff, buff_sz, cs) + { + length(0); + } + StringBuffer(const char *str, size_t length, const CHARSET_INFO *cs) + : String(buff, buff_sz, cs) + { + set(str, length, cs); + } +}; + + static inline bool check_if_only_end_space(CHARSET_INFO *cs, const char *str, const char *end) |