Commit 85f35cbf authored by unknown's avatar unknown

All String->set() now have charset argument

parent 2b6c55db
...@@ -4316,17 +4316,15 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs) ...@@ -4316,17 +4316,15 @@ int Field_blob::store(const char *from,uint len,CHARSET_INFO *cs)
int Field_blob::store(double nr) int Field_blob::store(double nr)
{ {
value.set(nr); value.set(nr,2,my_thd_charset);
return Field_blob::store(value.ptr(),(uint) value.length(), return Field_blob::store(value.ptr(),(uint) value.length(), value.charset());
default_charset_info);
} }
int Field_blob::store(longlong nr) int Field_blob::store(longlong nr)
{ {
value.set(nr); value.set(nr,my_thd_charset);
return Field_blob::store(value.ptr(), (uint) value.length(), return Field_blob::store(value.ptr(), (uint) value.length(), value.charset());
default_charset_info);
} }
......
...@@ -234,7 +234,7 @@ table_map Item_field::used_tables() const ...@@ -234,7 +234,7 @@ table_map Item_field::used_tables() const
String *Item_int::val_str(String *str) String *Item_int::val_str(String *str)
{ {
str->set(value); str->set(value, my_thd_charset);
return str; return str;
} }
...@@ -242,7 +242,7 @@ void Item_int::print(String *str) ...@@ -242,7 +242,7 @@ void Item_int::print(String *str)
{ {
if (!name) if (!name)
{ {
str_value.set(value); str_value.set(value, my_thd_charset);
name=str_value.c_ptr(); name=str_value.c_ptr();
} }
str->append(name); str->append(name);
...@@ -250,7 +250,7 @@ void Item_int::print(String *str) ...@@ -250,7 +250,7 @@ void Item_int::print(String *str)
String *Item_uint::val_str(String *str) String *Item_uint::val_str(String *str)
{ {
str->set((ulonglong) value); str->set((ulonglong) value, my_thd_charset);
return str; return str;
} }
...@@ -258,7 +258,7 @@ void Item_uint::print(String *str) ...@@ -258,7 +258,7 @@ void Item_uint::print(String *str)
{ {
if (!name) if (!name)
{ {
str_value.set((ulonglong) value); str_value.set((ulonglong) value, my_thd_charset);
name=str_value.c_ptr(); name=str_value.c_ptr();
} }
str->append(name); str->append(name);
...@@ -267,7 +267,7 @@ void Item_uint::print(String *str) ...@@ -267,7 +267,7 @@ void Item_uint::print(String *str)
String *Item_real::val_str(String *str) String *Item_real::val_str(String *str)
{ {
str->set(value,decimals); str->set(value,decimals,my_thd_charset);
return str; return str;
} }
...@@ -384,10 +384,10 @@ String *Item_param::val_str(String* str) ...@@ -384,10 +384,10 @@ String *Item_param::val_str(String* str)
{ {
switch (item_result_type) { switch (item_result_type) {
case INT_RESULT: case INT_RESULT:
str->set(int_value); str->set(int_value, my_thd_charset);
return str; return str;
case REAL_RESULT: case REAL_RESULT:
str->set(real_value); str->set(real_value, 2, my_thd_charset);
return str; return str;
default: default:
return (String*) &str_value; return (String*) &str_value;
......
...@@ -245,7 +245,7 @@ String *Item_real_func::val_str(String *str) ...@@ -245,7 +245,7 @@ String *Item_real_func::val_str(String *str)
if (null_value) if (null_value)
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
else else
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
return str; return str;
} }
...@@ -258,9 +258,9 @@ String *Item_num_func::val_str(String *str) ...@@ -258,9 +258,9 @@ String *Item_num_func::val_str(String *str)
if (null_value) if (null_value)
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
else if (!unsigned_flag) else if (!unsigned_flag)
str->set(nr); str->set(nr,my_thd_charset);
else else
str->set((ulonglong) nr); str->set((ulonglong) nr,my_thd_charset);
} }
else else
{ {
...@@ -268,7 +268,7 @@ String *Item_num_func::val_str(String *str) ...@@ -268,7 +268,7 @@ String *Item_num_func::val_str(String *str)
if (null_value) if (null_value)
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
else else
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
} }
return str; return str;
} }
...@@ -288,9 +288,9 @@ String *Item_int_func::val_str(String *str) ...@@ -288,9 +288,9 @@ String *Item_int_func::val_str(String *str)
if (null_value) if (null_value)
return 0; return 0;
else if (!unsigned_flag) else if (!unsigned_flag)
str->set(nr); str->set(nr,my_thd_charset);
else else
str->set((ulonglong) nr); str->set((ulonglong) nr,my_thd_charset);
return str; return str;
} }
...@@ -317,9 +317,9 @@ String *Item_num_op::val_str(String *str) ...@@ -317,9 +317,9 @@ String *Item_num_op::val_str(String *str)
if (null_value) if (null_value)
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
else if (!unsigned_flag) else if (!unsigned_flag)
str->set(nr); str->set(nr,my_thd_charset);
else else
str->set((ulonglong) nr); str->set((ulonglong) nr,my_thd_charset);
} }
else else
{ {
...@@ -327,7 +327,7 @@ String *Item_num_op::val_str(String *str) ...@@ -327,7 +327,7 @@ String *Item_num_op::val_str(String *str)
if (null_value) if (null_value)
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
else else
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
} }
return str; return str;
} }
...@@ -815,9 +815,9 @@ String *Item_func_min_max::val_str(String *str) ...@@ -815,9 +815,9 @@ String *Item_func_min_max::val_str(String *str)
if (null_value) if (null_value)
return 0; return 0;
else if (!unsigned_flag) else if (!unsigned_flag)
str->set(nr); str->set(nr,my_thd_charset);
else else
str->set((ulonglong) nr); str->set((ulonglong) nr,my_thd_charset);
return str; return str;
} }
case REAL_RESULT: case REAL_RESULT:
...@@ -826,7 +826,7 @@ String *Item_func_min_max::val_str(String *str) ...@@ -826,7 +826,7 @@ String *Item_func_min_max::val_str(String *str)
if (null_value) if (null_value)
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
else else
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
return str; return str;
} }
case STRING_RESULT: case STRING_RESULT:
...@@ -1449,7 +1449,7 @@ String *Item_func_udf_float::val_str(String *str) ...@@ -1449,7 +1449,7 @@ String *Item_func_udf_float::val_str(String *str)
if (null_value) if (null_value)
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
else else
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
return str; return str;
} }
...@@ -1470,9 +1470,9 @@ String *Item_func_udf_int::val_str(String *str) ...@@ -1470,9 +1470,9 @@ String *Item_func_udf_int::val_str(String *str)
if (null_value) if (null_value)
return 0; return 0;
else if (!unsigned_flag) else if (!unsigned_flag)
str->set(nr); str->set(nr,my_thd_charset);
else else
str->set((ulonglong) nr); str->set((ulonglong) nr,my_thd_charset);
return str; return str;
} }
...@@ -2036,10 +2036,10 @@ Item_func_get_user_var::val_str(String *str) ...@@ -2036,10 +2036,10 @@ Item_func_get_user_var::val_str(String *str)
return NULL; return NULL;
switch (entry->type) { switch (entry->type) {
case REAL_RESULT: case REAL_RESULT:
str->set(*(double*) entry->value,decimals); str->set(*(double*) entry->value,decimals,my_thd_charset);
break; break;
case INT_RESULT: case INT_RESULT:
str->set(*(longlong*) entry->value); str->set(*(longlong*) entry->value,my_thd_charset);
break; break;
case STRING_RESULT: case STRING_RESULT:
if (str->copy(entry->value, entry->length-1)) if (str->copy(entry->value, entry->length-1))
......
...@@ -1469,7 +1469,7 @@ String *Item_func_format::val_str(String *str) ...@@ -1469,7 +1469,7 @@ String *Item_func_format::val_str(String *str)
if ((null_value=args[0]->null_value)) if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
dec= decimals ? decimals+1 : 0; dec= decimals ? decimals+1 : 0;
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
str_length=str->length(); str_length=str->length();
if (nr < 0) if (nr < 0)
str_length--; // Don't count sign str_length--; // Don't count sign
......
...@@ -200,7 +200,7 @@ String *Item_exists_subselect::val_str(String *str) ...@@ -200,7 +200,7 @@ String *Item_exists_subselect::val_str(String *str)
assign_null(); assign_null();
return 0; return 0;
} }
str->set(value); str->set(value,my_thd_charset);
return str; return str;
} }
......
...@@ -93,7 +93,7 @@ Item_sum_num::val_str(String *str) ...@@ -93,7 +93,7 @@ Item_sum_num::val_str(String *str)
double nr=val(); double nr=val();
if (null_value) if (null_value)
return 0; return 0;
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
return str; return str;
} }
...@@ -359,13 +359,13 @@ Item_sum_hybrid::val_str(String *str) ...@@ -359,13 +359,13 @@ Item_sum_hybrid::val_str(String *str)
case STRING_RESULT: case STRING_RESULT:
return &value; return &value;
case REAL_RESULT: case REAL_RESULT:
str->set(sum,decimals); str->set(sum,decimals,my_thd_charset);
break; break;
case INT_RESULT: case INT_RESULT:
if (unsigned_flag) if (unsigned_flag)
str->set((ulonglong) sum_int); str->set((ulonglong) sum_int,my_thd_charset);
else else
str->set((longlong) sum_int); str->set((longlong) sum_int,my_thd_charset);
break; break;
} }
return str; // Keep compiler happy return str; // Keep compiler happy
...@@ -810,7 +810,7 @@ String *Item_avg_field::val_str(String *str) ...@@ -810,7 +810,7 @@ String *Item_avg_field::val_str(String *str)
double nr=Item_avg_field::val(); double nr=Item_avg_field::val();
if (null_value) if (null_value)
return 0; return 0;
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
return str; return str;
} }
...@@ -847,7 +847,7 @@ String *Item_std_field::val_str(String *str) ...@@ -847,7 +847,7 @@ String *Item_std_field::val_str(String *str)
double nr=val(); double nr=val();
if (null_value) if (null_value)
return 0; return 0;
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
return str; return str;
} }
...@@ -1174,7 +1174,7 @@ String *Item_sum_udf_float::val_str(String *str) ...@@ -1174,7 +1174,7 @@ String *Item_sum_udf_float::val_str(String *str)
if (null_value) if (null_value)
return 0; /* purecov: inspected */ return 0; /* purecov: inspected */
else else
str->set(nr,decimals); str->set(nr,decimals,my_thd_charset);
return str; return str;
} }
...@@ -1193,7 +1193,7 @@ String *Item_sum_udf_int::val_str(String *str) ...@@ -1193,7 +1193,7 @@ String *Item_sum_udf_int::val_str(String *str)
if (null_value) if (null_value)
return 0; return 0;
else else
str->set(nr); str->set(nr,my_thd_charset);
return str; return str;
} }
......
...@@ -67,7 +67,11 @@ public: ...@@ -67,7 +67,11 @@ public:
Item_func_month(Item *a) :Item_func(a) {} Item_func_month(Item *a) :Item_func(a) {}
longlong val_int(); longlong val_int();
double val() { return (double) Item_func_month::val_int(); } double val() { return (double) Item_func_month::val_int(); }
String *val_str(String *str) { str->set(val_int()); return null_value ? 0 : str;} String *val_str(String *str)
{
str->set(val_int(), my_thd_charset);
return null_value ? 0 : str;
}
const char *func_name() const { return "month"; } const char *func_name() const { return "month"; }
enum Item_result result_type () const { return INT_RESULT; } enum Item_result result_type () const { return INT_RESULT; }
void fix_length_and_dec() { decimals=0; max_length=2; maybe_null=1; } void fix_length_and_dec() { decimals=0; max_length=2; maybe_null=1; }
...@@ -172,7 +176,10 @@ public: ...@@ -172,7 +176,10 @@ public:
:Item_func(a), odbc_type(type_arg) {} :Item_func(a), odbc_type(type_arg) {}
longlong val_int(); longlong val_int();
double val() { return (double) val_int(); } double val() { return (double) val_int(); }
String *val_str(String *str) { str->set(val_int()); return null_value ? 0 : str;} String *val_str(String *str) {
str->set(val_int(), my_thd_charset);
return null_value ? 0 : str;
}
const char *func_name() const { return "weekday"; } const char *func_name() const { return "weekday"; }
enum Item_result result_type () const { return INT_RESULT; } enum Item_result result_type () const { return INT_RESULT; }
void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1; } void fix_length_and_dec() { decimals=0; max_length=1; maybe_null=1; }
......
...@@ -61,6 +61,8 @@ char* query_table_status(THD *thd,const char *db,const char *table_name); ...@@ -61,6 +61,8 @@ char* query_table_status(THD *thd,const char *db,const char *table_name);
#endif #endif
#endif #endif
#define my_thd_charset default_charset_info
/*************************************************************************** /***************************************************************************
Configuration parameters Configuration parameters
****************************************************************************/ ****************************************************************************/
......
...@@ -62,7 +62,7 @@ public: ...@@ -62,7 +62,7 @@ public:
{ value=atof(str); } { value=atof(str); }
double val() { return value; } double val() { return value; }
longlong val_int() { return (longlong) value; } longlong val_int() { return (longlong) value; }
String *val_str(String *s) { s->set(value,decimals); return s; } String *val_str(String *s) { s->set(value,decimals,my_thd_charset); return s; }
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
...@@ -80,7 +80,7 @@ public: ...@@ -80,7 +80,7 @@ public:
{ value=strtoll(str,NULL,10); } { value=strtoll(str,NULL,10); }
double val() { return (double) value; } double val() { return (double) value; }
longlong val_int() { return value; } longlong val_int() { return value; }
String *val_str(String *s) { s->set(value); return s; } String *val_str(String *s) { s->set(value, my_thd_charset); return s; }
unsigned int size_of() { return sizeof(*this);} unsigned int size_of() { return sizeof(*this);}
}; };
...@@ -92,8 +92,8 @@ public: ...@@ -92,8 +92,8 @@ public:
{ this->max_length=length; } { this->max_length=length; }
enum Item_result result_type () const { return STRING_RESULT; } enum Item_result result_type () const { return STRING_RESULT; }
enum_field_types field_type() const { return FIELD_TYPE_STRING; } enum_field_types field_type() const { return FIELD_TYPE_STRING; }
void set(double nr) { str_value.set(nr); } void set(double nr) { str_value.set(nr, 2, my_thd_charset); }
void set(longlong nr) { str_value.set(nr); } void set(longlong nr) { str_value.set(nr, my_thd_charset); }
void set(const char *str, uint length) { str_value.copy(str,length); } void set(const char *str, uint length) { str_value.copy(str,length); }
double val() { return atof(str_value.ptr()); } double val() { return atof(str_value.ptr()); }
longlong val_int() { return strtoll(str_value.ptr(),NULL,10); } longlong val_int() { return strtoll(str_value.ptr(),NULL,10); }
......
...@@ -903,7 +903,7 @@ int collect_real(double *element, element_count count __attribute__((unused)), ...@@ -903,7 +903,7 @@ int collect_real(double *element, element_count count __attribute__((unused)),
else else
info->found = 1; info->found = 1;
info->str->append('\''); info->str->append('\'');
s.set(*element, info->item->decimals); s.set(*element, info->item->decimals, my_thd_charset);
info->str->append(s); info->str->append(s);
info->str->append('\''); info->str->append('\'');
return 0; return 0;
...@@ -922,7 +922,7 @@ int collect_longlong(longlong *element, ...@@ -922,7 +922,7 @@ int collect_longlong(longlong *element,
else else
info->found = 1; info->found = 1;
info->str->append('\''); info->str->append('\'');
s.set(*element); s.set(*element,default_charset_info);
info->str->append(s); info->str->append(s);
info->str->append('\''); info->str->append('\'');
return 0; return 0;
...@@ -941,7 +941,7 @@ int collect_ulonglong(ulonglong *element, ...@@ -941,7 +941,7 @@ int collect_ulonglong(ulonglong *element,
else else
info->found = 1; info->found = 1;
info->str->append('\''); info->str->append('\'');
s.set(*element); s.set(*element,default_charset_info);
info->str->append(s); info->str->append(s);
info->str->append('\''); info->str->append('\'');
return 0; return 0;
......
...@@ -128,10 +128,10 @@ public: ...@@ -128,10 +128,10 @@ public:
String *avg(String *s, ha_rows rows) String *avg(String *s, ha_rows rows)
{ {
if (!(rows - nulls)) if (!(rows - nulls))
s->set((double) 0.0, 1); s->set((double) 0.0, 1,my_thd_charset);
else else
s->set((ulonglong2double(sum) / ulonglong2double(rows - nulls)), s->set((ulonglong2double(sum) / ulonglong2double(rows - nulls)),
DEC_IN_AVG); DEC_IN_AVG,my_thd_charset);
return s; return s;
} }
friend int collect_string(String *element, element_count count, friend int collect_string(String *element, element_count count,
...@@ -160,26 +160,34 @@ public: ...@@ -160,26 +160,34 @@ public:
void add(); void add();
void get_opt_type(String*, ha_rows); void get_opt_type(String*, ha_rows);
String *get_min_arg(String *s) { s->set(min_arg, item->decimals); return s; } String *get_min_arg(String *s)
String *get_max_arg(String *s) { s->set(max_arg, item->decimals); return s; } {
s->set(min_arg, item->decimals,my_thd_charset);
return s;
}
String *get_max_arg(String *s)
{
s->set(max_arg, item->decimals,my_thd_charset);
return s;
}
String *avg(String *s, ha_rows rows) String *avg(String *s, ha_rows rows)
{ {
if (!(rows - nulls)) if (!(rows - nulls))
s->set((double) 0.0, 1); s->set((double) 0.0, 1,my_thd_charset);
else else
s->set(((double)sum / (double) (rows - nulls)), item->decimals); s->set(((double)sum / (double) (rows - nulls)), item->decimals,my_thd_charset);
return s; return s;
} }
String *std(String *s, ha_rows rows) String *std(String *s, ha_rows rows)
{ {
double tmp = ulonglong2double(rows); double tmp = ulonglong2double(rows);
if (!(tmp - nulls)) if (!(tmp - nulls))
s->set((double) 0.0, 1); s->set((double) 0.0, 1,my_thd_charset);
else else
{ {
double tmp2 = ((sum_sqr - sum * sum / (tmp - nulls)) / double tmp2 = ((sum_sqr - sum * sum / (tmp - nulls)) /
(tmp - nulls)); (tmp - nulls));
s->set(((double) tmp2 <= 0.0 ? 0.0 : sqrt(tmp2)), item->decimals); s->set(((double) tmp2 <= 0.0 ? 0.0 : sqrt(tmp2)), item->decimals,my_thd_charset);
} }
return s; return s;
} }
...@@ -206,26 +214,26 @@ public: ...@@ -206,26 +214,26 @@ public:
void add(); void add();
void get_opt_type(String*, ha_rows); void get_opt_type(String*, ha_rows);
String *get_min_arg(String *s) { s->set(min_arg); return s; } String *get_min_arg(String *s) { s->set(min_arg,my_thd_charset); return s; }
String *get_max_arg(String *s) { s->set(max_arg); return s; } String *get_max_arg(String *s) { s->set(max_arg,my_thd_charset); return s; }
String *avg(String *s, ha_rows rows) String *avg(String *s, ha_rows rows)
{ {
if (!(rows - nulls)) if (!(rows - nulls))
s->set((double) 0.0, 1); s->set((double) 0.0, 1,my_thd_charset);
else else
s->set(((double) sum / (double) (rows - nulls)), DEC_IN_AVG); s->set(((double) sum / (double) (rows - nulls)), DEC_IN_AVG,my_thd_charset);
return s; return s;
} }
String *std(String *s, ha_rows rows) String *std(String *s, ha_rows rows)
{ {
double tmp = ulonglong2double(rows); double tmp = ulonglong2double(rows);
if (!(tmp - nulls)) if (!(tmp - nulls))
s->set((double) 0.0, 1); s->set((double) 0.0, 1,my_thd_charset);
else else
{ {
double tmp2 = ((sum_sqr - sum * sum / (tmp - nulls)) / double tmp2 = ((sum_sqr - sum * sum / (tmp - nulls)) /
(tmp - nulls)); (tmp - nulls));
s->set(((double) tmp2 <= 0.0 ? 0.0 : sqrt(tmp2)), DEC_IN_AVG); s->set(((double) tmp2 <= 0.0 ? 0.0 : sqrt(tmp2)), DEC_IN_AVG,my_thd_charset);
} }
return s; return s;
} }
...@@ -250,28 +258,28 @@ public: ...@@ -250,28 +258,28 @@ public:
(qsort_cmp2) compare_ulonglong2, 0, NULL, NULL); } (qsort_cmp2) compare_ulonglong2, 0, NULL, NULL); }
void add(); void add();
void get_opt_type(String*, ha_rows); void get_opt_type(String*, ha_rows);
String *get_min_arg(String *s) { s->set(min_arg); return s; } String *get_min_arg(String *s) { s->set(min_arg,my_thd_charset); return s; }
String *get_max_arg(String *s) { s->set(max_arg); return s; } String *get_max_arg(String *s) { s->set(max_arg,my_thd_charset); return s; }
String *avg(String *s, ha_rows rows) String *avg(String *s, ha_rows rows)
{ {
if (!(rows - nulls)) if (!(rows - nulls))
s->set((double) 0.0, 1); s->set((double) 0.0, 1,my_thd_charset);
else else
s->set((ulonglong2double(sum) / ulonglong2double(rows - nulls)), s->set((ulonglong2double(sum) / ulonglong2double(rows - nulls)),
DEC_IN_AVG); DEC_IN_AVG,my_thd_charset);
return s; return s;
} }
String *std(String *s, ha_rows rows) String *std(String *s, ha_rows rows)
{ {
double tmp = ulonglong2double(rows); double tmp = ulonglong2double(rows);
if (!(tmp - nulls)) if (!(tmp - nulls))
s->set((double) 0.0, 1); s->set((double) 0.0, 1,my_thd_charset);
else else
{ {
double tmp2 = ((ulonglong2double(sum_sqr) - double tmp2 = ((ulonglong2double(sum_sqr) -
ulonglong2double(sum * sum) / (tmp - nulls)) / ulonglong2double(sum * sum) / (tmp - nulls)) /
(tmp - nulls)); (tmp - nulls));
s->set(((double) tmp2 <= 0.0 ? 0.0 : sqrt(tmp2)), DEC_IN_AVG); s->set(((double) tmp2 <= 0.0 ? 0.0 : sqrt(tmp2)), DEC_IN_AVG,my_thd_charset);
} }
return s; return s;
} }
......
...@@ -91,25 +91,29 @@ bool String::realloc(uint32 alloc_length) ...@@ -91,25 +91,29 @@ bool String::realloc(uint32 alloc_length)
return FALSE; return FALSE;
} }
bool String::set(longlong num) bool String::set(longlong num, CHARSET_INFO *cs)
{ {
if (alloc(21)) if (alloc(21))
return TRUE; return TRUE;
str_length=(uint32) (longlong10_to_str(num,Ptr,-10)-Ptr); str_length=(uint32) (longlong10_to_str(num,Ptr,-10)-Ptr);
str_charset=cs;
return FALSE; return FALSE;
} }
bool String::set(ulonglong num) bool String::set(ulonglong num, CHARSET_INFO *cs)
{ {
if (alloc(21)) if (alloc(21))
return TRUE; return TRUE;
str_length=(uint32) (longlong10_to_str(num,Ptr,10)-Ptr); str_length=(uint32) (longlong10_to_str(num,Ptr,10)-Ptr);
str_charset=cs;
return FALSE; return FALSE;
} }
bool String::set(double num,uint decimals) bool String::set(double num,uint decimals, CHARSET_INFO *cs)
{ {
char buff[331]; char buff[331];
str_charset=cs;
if (decimals >= NOT_FIXED_DEC) if (decimals >= NOT_FIXED_DEC)
{ {
sprintf(buff,"%.14g",num); // Enough for a DATETIME sprintf(buff,"%.14g",num); // Enough for a DATETIME
......
...@@ -125,10 +125,9 @@ public: ...@@ -125,10 +125,9 @@ public:
} }
str_charset=cs; str_charset=cs;
} }
bool set(longlong num); bool set(longlong num, CHARSET_INFO *cs);
/* bool set(long num); */ bool set(ulonglong num, CHARSET_INFO *cs);
bool set(ulonglong num); bool set(double num,uint decimals, CHARSET_INFO *cs);
bool set(double num,uint decimals=2);
inline void free() inline void free()
{ {
if (alloced) if (alloced)
......
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