diff options
Diffstat (limited to 'sql/item.cc')
-rw-r--r-- | sql/item.cc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/sql/item.cc b/sql/item.cc index 803c9fee576..a415464a2f9 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -218,6 +218,24 @@ bool Item::val_bool() } +String *Item::val_str(String *str, String *converter, CHARSET_INFO *cs) +{ + String *res= val_str(str); + if (null_value) + return (String *) 0; + + if (!cs) + return res; + + uint errors; + if ((null_value= converter->copy(res->ptr(), res->length(), + collation.collation, cs, &errors))) + return (String *) 0; + + return converter; +} + + String *Item::val_string_from_real(String *str) { double nr= val_real(); |