diff options
Diffstat (limited to 'sql/item_func.cc')
-rw-r--r-- | sql/item_func.cc | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/sql/item_func.cc b/sql/item_func.cc index 33521edbbd4..10021b11769 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1080,9 +1080,26 @@ err: void Item_decimal_typecast::print(String *str) { + char len_buf[20*3 + 1]; + char *end; + CHARSET_INFO *cs= str->charset(); + + uint precision= my_decimal_length_to_precision(max_length, decimals, + unsigned_flag); str->append(STRING_WITH_LEN("cast(")); args[0]->print(str); - str->append(STRING_WITH_LEN(" as decimal)")); + str->append(STRING_WITH_LEN(" as decimal(")); + + end=int10_to_str(precision, len_buf,10); + str->append(len_buf, (uint32) (end - len_buf)); + + str->append(','); + + end=int10_to_str(decimals, len_buf,10); + str->append(len_buf, (uint32) (end - len_buf)); + + str->append(')'); + str->append(')'); } |