diff options
author | Sergey Petrunya <psergey@askmonty.org> | 2013-08-24 00:46:49 +0400 |
---|---|---|
committer | Sergey Petrunya <psergey@askmonty.org> | 2013-08-24 00:46:49 +0400 |
commit | 662bfed027dbf29d1d185ae677f0b5c79920287b (patch) | |
tree | e93419f19a639244b5f4b43d4af889b5330f4743 /sql/sql_string.h | |
parent | 97e640b9ae83e07b444fceede6b0524256c7a3cc (diff) | |
parent | ef47cc1f091f76740212e125fe91f113028cbaa8 (diff) | |
download | mariadb-git-662bfed027dbf29d1d185ae677f0b5c79920287b.tar.gz |
[SHOW] EXPLAIN UPDATE/DELETE, code re-structuring
- Merge with current 10.0-base
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 ab065f7bdfc..723569205f5 100644 --- a/sql/sql_string.h +++ b/sql/sql_string.h @@ -511,6 +511,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) |