diff options
author | Alexander Barkov <bar@mariadb.org> | 2015-09-23 13:04:28 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2015-09-23 13:04:28 +0400 |
commit | 212698b152609a7b17b45f9499fd650229985558 (patch) | |
tree | 5f1274679dc91f59cb177c8653d9a9f47db1ccbe /sql/sql_string.cc | |
parent | 180c44e0f600dc9e220887e213679f0d60f29a68 (diff) | |
download | mariadb-git-212698b152609a7b17b45f9499fd650229985558.tar.gz |
MDEV-8253 EXPLAIN SELECT prints unexpected characters
Item_string::clone_item() creates a new Item_string that
points exactly to the same buffer that the original one does.
Later, Item_string::print() uses c_ptr() for the original Item_string,
which reallocs the original buffer, and the clone remain with
the old freed buffer.
Refactoring the code not to use c_ptr() in Item_string::print().
Diffstat (limited to 'sql/sql_string.cc')
-rw-r--r-- | sql/sql_string.cc | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/sql/sql_string.cc b/sql/sql_string.cc index 379609ad6e7..b14c3afca4b 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -954,6 +954,16 @@ void String::print(String *str) const str->append_for_single_quote(Ptr, str_length); } + +void String::print_with_conversion(String *print, CHARSET_INFO *cs) const +{ + StringBuffer<256> tmp(cs); + uint errors= 0; + tmp.copy(this, cs, &errors); + tmp.print(print); +} + + /* Exchange state of this object and argument. |