summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/field.cc24
-rw-r--r--sql/item.cc2
2 files changed, 7 insertions, 19 deletions
diff --git a/sql/field.cc b/sql/field.cc
index 0804797c1eb..dbf285c6973 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -4786,16 +4786,10 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs)
if (length < 6) // Can't be more than 99999 enums
{
/* This is for reading numbers with LOAD DATA INFILE */
- char buff[7], *end;
- const char *conv=from;
- if (from[length])
- {
- strmake(buff, from, length);
- conv=buff;
- }
+ char *end;
my_errno=0;
- tmp=(uint) strtoul(conv,&end,10);
- if (my_errno || end != conv+length || tmp > typelib->count)
+ tmp=(uint) my_strntoul(cs,from,length,&end,10);
+ if (my_errno || end != from+length || tmp > typelib->count)
{
tmp=0;
current_thd->cuted_fields++;
@@ -4990,16 +4984,10 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
if (!tmp && length && length < 22)
{
/* This is for reading numbers with LOAD DATA INFILE */
- char buff[22], *end;
- const char *conv=from;
- if (from[length])
- {
- strmake(buff, from, length);
- conv=buff;
- }
+ char *end;
my_errno=0;
- tmp=strtoull(conv,&end,10);
- if (my_errno || end != conv+length ||
+ tmp=my_strntoull(cs,from,length,&end,10);
+ if (my_errno || end != from+length ||
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
{
tmp=0;
diff --git a/sql/item.cc b/sql/item.cc
index f21cd0fc0f3..568ad74a631 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -395,7 +395,7 @@ longlong Item_param::val_int()
{
switch (item_result_type) {
case STRING_RESULT:
- return strtoll(str_value.ptr(),(char**) 0,10);
+ return my_strntoll(str_value.charset(),str_value.ptr(),str_value.length(),(char**) 0,10);
case REAL_RESULT:
return (longlong) (real_value+(real_value > 0 ? 0.5 : -0.5));
default: