Commit 60d60a29 authored by serg@serg.mylan's avatar serg@serg.mylan

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

parent 9837748e
...@@ -540,3 +540,4 @@ libmysql/vio_priv.h ...@@ -540,3 +540,4 @@ libmysql/vio_priv.h
libmysql_r/vio_priv.h libmysql_r/vio_priv.h
hardcopy.0 hardcopy.0
scripts/make_sharedlib_distribution scripts/make_sharedlib_distribution
sql/udf_example.so
...@@ -67,3 +67,11 @@ select * from t1 limit 9999999999; ...@@ -67,3 +67,11 @@ select * from t1 limit 9999999999;
id a id a
9999999999 1 9999999999 1
drop table t1; 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); ...@@ -46,3 +46,15 @@ insert into t1 values (null,1);
select * from t1; select * from t1;
select * from t1 limit 9999999999; select * from t1 limit 9999999999;
drop table t1; 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) ...@@ -548,6 +548,19 @@ bool Item_string::save_in_field(Field *field, bool no_conversions)
return 0; 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) bool Item_int::save_in_field(Field *field, bool no_conversions)
{ {
longlong nr=val_int(); longlong nr=val_int();
......
...@@ -232,6 +232,7 @@ class Item_uint :public Item_int ...@@ -232,6 +232,7 @@ class Item_uint :public Item_int
String *val_str(String*); String *val_str(String*);
void make_field(Send_field *field); void make_field(Send_field *field);
Item *new_item() { return new Item_uint(name,max_length); } 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) bool fix_fields(THD *thd,struct st_table_list *table_list)
{ {
unsigned_flag= 1; unsigned_flag= 1;
......
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