summaryrefslogtreecommitdiff
path: root/sql/field.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-06-01 13:42:39 -0700
committerIgor Babaev <igor@askmonty.org>2012-06-01 13:42:39 -0700
commit27ab01243cbc7ddba29704afe31d0812652be19b (patch)
treeb50e061d5fe668cc49d270664a67422dd043e9d5 /sql/field.cc
parent6ac0363426f96c26c64447f0aa7fbd8a13ecc313 (diff)
parentafedd72e225654225b20a91b072b012e4c57a9d4 (diff)
downloadmariadb-git-27ab01243cbc7ddba29704afe31d0812652be19b.tar.gz
Merge
Diffstat (limited to 'sql/field.cc')
-rw-r--r--sql/field.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 5975759f51d..f5830a463d5 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -7876,7 +7876,19 @@ String *Field_set::val_str(String *val_buffer,
ulonglong tmp=(ulonglong) Field_enum::val_int();
uint bitnr=0;
- val_buffer->set("", 0, field_charset);
+ if (tmp == 0)
+ {
+ /*
+ Some callers expect *val_buffer to contain the result,
+ so we assign to it, rather than doing 'return &empty_set_string.
+ */
+ *val_buffer= empty_set_string;
+ return val_buffer;
+ }
+
+ val_buffer->set_charset(field_charset);
+ val_buffer->length(0);
+
while (tmp && bitnr < (uint) typelib->count)
{
if (tmp & 1)