Commit c89e927a authored by Monty's avatar Monty

Clean up Item_uint() & Item_int()

- Removed val_str() and print() as these are handled by Item_int()
- Use local StringBuffer for Item_int::print() to avoid mallocs
parent 5e76e234
......@@ -796,6 +796,8 @@ inline unsigned long long my_double2ulonglong(double d)
#define LONGLONG_MIN ((long long) 0x8000000000000000LL)
#define LONGLONG_MAX ((long long) 0x7FFFFFFFFFFFFFFFLL)
#endif
/* Max length needed for a buffer to hold a longlong or ulonglong + end \0 */
#define LONGLONG_BUFFER_SIZE 21
#if defined(HAVE_LONG_LONG) && !defined(ULONGLONG_MAX)
/* First check for ANSI C99 definition: */
......
......@@ -3626,9 +3626,10 @@ String *Item_int::val_str(String *str)
void Item_int::print(String *str, enum_query_type query_type)
{
StringBuffer<LONGLONG_BUFFER_SIZE> buf;
// my_charset_bin is good enough for numbers
str_value.set_int(value, unsigned_flag, &my_charset_bin);
str->append(str_value);
buf.set_int(value, unsigned_flag, &my_charset_bin);
str->append(buf);
}
......@@ -3654,21 +3655,6 @@ Item_uint::Item_uint(THD *thd, const char *str_arg, longlong i, uint length):
}
String *Item_uint::val_str(String *str)
{
str->set((ulonglong) value, collation.collation);
return str;
}
void Item_uint::print(String *str, enum_query_type query_type)
{
// latin1 is good enough for numbers
str_value.set((ulonglong) value, default_charset());
str->append(str_value);
}
Item_decimal::Item_decimal(THD *thd, const char *str_arg, size_t length,
CHARSET_INFO *charset):
Item_num(thd)
......
......@@ -4238,9 +4238,7 @@ class Item_uint :public Item_int
Item_uint(THD *thd, ulonglong i): Item_int(thd, i, 10) {}
Item_uint(THD *thd, const char *str_arg, longlong i, uint length);
double val_real() { return ulonglong2double((ulonglong)value); }
String *val_str(String*);
Item *clone_item(THD *thd);
virtual void print(String *str, enum_query_type query_type);
Item *neg(THD *thd);
uint decimal_precision() const { return max_length; }
Item *get_copy(THD *thd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment