Commit 069ec78c authored by unknown's avatar unknown

Item_uint::save_in_field() added to take into account bigint->decimal case


BitKeeper/etc/ignore:
  Added sql/udf_example.so to the ignore list
parent a35ba0ea
......@@ -540,3 +540,4 @@ libmysql/vio_priv.h
libmysql_r/vio_priv.h
hardcopy.0
scripts/make_sharedlib_distribution
sql/udf_example.so
......@@ -67,3 +67,11 @@ select * from t1 limit 9999999999;
id a
9999999999 1
drop table t1;
CREATE TABLE t1 ( quantity decimal(60,0));
insert into t1 values (10000000000000000000);
insert into t1 values ('10000000000000000000');
select * from t1;
quantity
10000000000000000000
10000000000000000000
drop table t1;
......@@ -46,3 +46,15 @@ insert into t1 values (null,1);
select * from t1;
select * from t1 limit 9999999999;
drop table t1;
#
# Item_uint::save_to_field()
# BUG#1845
#
CREATE TABLE t1 ( quantity decimal(60,0));
insert into t1 values (10000000000000000000);
insert into t1 values ('10000000000000000000');
select * from t1;
drop table t1;
......@@ -548,6 +548,19 @@ bool Item_string::save_in_field(Field *field, bool no_conversions)
return 0;
}
bool Item_uint::save_in_field(Field *field, bool no_conversions)
{
longlong nr=val_int();
if (null_value)
return set_field_to_null(field);
field->set_notnull();
if (nr < 0)
field->store(ulonglong2double(nr));
else
field->store(nr);
return 0;
}
bool Item_int::save_in_field(Field *field, bool no_conversions)
{
longlong nr=val_int();
......
......@@ -232,13 +232,14 @@ class Item_uint :public Item_int
String *val_str(String*);
void make_field(Send_field *field);
Item *new_item() { return new Item_uint(name,max_length); }
bool save_in_field(Field *field, bool no_conversions);
bool fix_fields(THD *thd,struct st_table_list *table_list)
{
unsigned_flag= 1;
return 0;
}
void print(String *str);
unsigned int size_of() { return sizeof(*this);}
unsigned int size_of() { return sizeof(*this);}
};
......
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