Commit 241f4143 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

More use of new string->number conversion routines

parent 072abca4
...@@ -4786,16 +4786,10 @@ int Field_enum::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -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 if (length < 6) // Can't be more than 99999 enums
{ {
/* This is for reading numbers with LOAD DATA INFILE */ /* This is for reading numbers with LOAD DATA INFILE */
char buff[7], *end; char *end;
const char *conv=from;
if (from[length])
{
strmake(buff, from, length);
conv=buff;
}
my_errno=0; my_errno=0;
tmp=(uint) strtoul(conv,&end,10); tmp=(uint) my_strntoul(cs,from,length,&end,10);
if (my_errno || end != conv+length || tmp > typelib->count) if (my_errno || end != from+length || tmp > typelib->count)
{ {
tmp=0; tmp=0;
current_thd->cuted_fields++; current_thd->cuted_fields++;
...@@ -4990,16 +4984,10 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs) ...@@ -4990,16 +4984,10 @@ int Field_set::store(const char *from,uint length,CHARSET_INFO *cs)
if (!tmp && length && length < 22) if (!tmp && length && length < 22)
{ {
/* This is for reading numbers with LOAD DATA INFILE */ /* This is for reading numbers with LOAD DATA INFILE */
char buff[22], *end; char *end;
const char *conv=from;
if (from[length])
{
strmake(buff, from, length);
conv=buff;
}
my_errno=0; my_errno=0;
tmp=strtoull(conv,&end,10); tmp=my_strntoull(cs,from,length,&end,10);
if (my_errno || end != conv+length || if (my_errno || end != from+length ||
tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1)) tmp > (ulonglong) (((longlong) 1 << typelib->count) - (longlong) 1))
{ {
tmp=0; tmp=0;
......
...@@ -395,7 +395,7 @@ longlong Item_param::val_int() ...@@ -395,7 +395,7 @@ longlong Item_param::val_int()
{ {
switch (item_result_type) { switch (item_result_type) {
case STRING_RESULT: 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: case REAL_RESULT:
return (longlong) (real_value+(real_value > 0 ? 0.5 : -0.5)); return (longlong) (real_value+(real_value > 0 ? 0.5 : -0.5));
default: default:
......
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