summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.bzrignore1
-rw-r--r--mysql-test/r/bigint.result8
-rw-r--r--mysql-test/t/bigint.test12
-rw-r--r--sql/item.cc13
-rw-r--r--sql/item.h3
5 files changed, 36 insertions, 1 deletions
diff --git a/.bzrignore b/.bzrignore
index 3dcf46841d9..12cdf99cbc9 100644
--- a/.bzrignore
+++ b/.bzrignore
@@ -540,3 +540,4 @@ libmysql/vio_priv.h
libmysql_r/vio_priv.h
hardcopy.0
scripts/make_sharedlib_distribution
+sql/udf_example.so
diff --git a/mysql-test/r/bigint.result b/mysql-test/r/bigint.result
index d7d811dc5f3..2b595c2b83d 100644
--- a/mysql-test/r/bigint.result
+++ b/mysql-test/r/bigint.result
@@ -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;
diff --git a/mysql-test/t/bigint.test b/mysql-test/t/bigint.test
index c5691a760c7..a7cc068ec46 100644
--- a/mysql-test/t/bigint.test
+++ b/mysql-test/t/bigint.test
@@ -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;
+
diff --git a/sql/item.cc b/sql/item.cc
index 0e9085180cd..65eb7f1befd 100644
--- a/sql/item.cc
+++ b/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();
diff --git a/sql/item.h b/sql/item.h
index 25650e85434..d23a061eedb 100644
--- a/sql/item.h
+++ b/sql/item.h
@@ -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);}
};