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
This commit is contained in:
parent
a35ba0ea0c
commit
069ec78c80
@ -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;
|
||||
|
||||
|
13
sql/item.cc
13
sql/item.cc
@ -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 @@ public:
|
||||
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);}
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user