Commit 632dff01 authored by bar@bar.mysql.r18.ru's avatar bar@bar.mysql.r18.ru

More use of new str->num functions

parent 43786fee
...@@ -3788,12 +3788,8 @@ int Field_string::store(longlong nr) ...@@ -3788,12 +3788,8 @@ int Field_string::store(longlong nr)
double Field_string::val_real(void) double Field_string::val_real(void)
{ {
double value; CHARSET_INFO *cs=charset();
char save=ptr[field_length]; // Ok to patch record return my_strntod(cs,ptr,field_length,(char**)0);
ptr[field_length]=0;
value=atof(ptr);
ptr[field_length]=save;
return value;
} }
...@@ -3989,13 +3985,9 @@ int Field_varstring::store(longlong nr) ...@@ -3989,13 +3985,9 @@ int Field_varstring::store(longlong nr)
double Field_varstring::val_real(void) double Field_varstring::val_real(void)
{ {
double value;
uint length=uint2korr(ptr)+2; uint length=uint2korr(ptr)+2;
char save=ptr[length]; // Ok to patch record CHARSET_INFO *cs=charset();
ptr[length]=0; return my_strntod(cs,ptr+2,length,(char**)0);
value=atof(ptr+2);
ptr[length]=save;
return value;
} }
...@@ -4326,12 +4318,8 @@ double Field_blob::val_real(void) ...@@ -4326,12 +4318,8 @@ double Field_blob::val_real(void)
if (!blob) if (!blob)
return 0.0; return 0.0;
uint32 length=get_length(ptr); uint32 length=get_length(ptr);
CHARSET_INFO *cs=charset();
char save=blob[length]; // Ok to patch blob in NISAM return my_strntod(cs,blob,length,(char**)0);
blob[length]=0;
double nr=atof(blob);
blob[length]=save;
return nr;
} }
......
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