diff options
author | bar@bar.mysql.r18.ru <> | 2002-11-27 18:08:31 +0400 |
---|---|---|
committer | bar@bar.mysql.r18.ru <> | 2002-11-27 18:08:31 +0400 |
commit | 95930f129ec7463ff0f1ec22513414976d83e6e8 (patch) | |
tree | 6bf8deff485129d2acae45c230f19de1912c5034 /sql | |
parent | 61141a30eed33cab7252e205902f53a17b1d5c43 (diff) | |
download | mariadb-git-95930f129ec7463ff0f1ec22513414976d83e6e8.tar.gz |
new string-to-number functions
Diffstat (limited to 'sql')
-rw-r--r-- | sql/field.cc | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/sql/field.cc b/sql/field.cc index f2324a0a331..e0910caeea2 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -921,8 +921,7 @@ void Field_decimal::sql_type(String &res) const int Field_tiny::store(const char *from,uint len,CHARSET_INFO *cs) { - String tmp_str(from,len,default_charset_info); - long tmp= strtol(tmp_str.c_ptr(),NULL,10); + long tmp= my_strntol(cs,from,len,(char **)NULL,10); int error= 0; if (unsigned_flag) @@ -1116,8 +1115,7 @@ void Field_tiny::sql_type(String &res) const int Field_short::store(const char *from,uint len,CHARSET_INFO *cs) { - String tmp_str(from,len,default_charset_info); - long tmp= strtol(tmp_str.c_ptr(),NULL,10); + long tmp= my_strntol(cs,from,len,NULL,10); int error= 0; if (unsigned_flag) { @@ -1380,8 +1378,7 @@ void Field_short::sql_type(String &res) const int Field_medium::store(const char *from,uint len,CHARSET_INFO *cs) { - String tmp_str(from,len,default_charset_info); - long tmp= strtol(tmp_str.c_ptr(),NULL,10); + long tmp= my_strntol(cs,from,len,NULL,10); int error= 0; if (unsigned_flag) @@ -3097,8 +3094,7 @@ void Field_time::sql_type(String &res) const int Field_year::store(const char *from, uint len,CHARSET_INFO *cs) { - String tmp_str(from,len,default_charset_info); - long nr= strtol(tmp_str.c_ptr(),NULL,10); + long nr= my_strntol(cs,from,len,NULL,10); if (nr < 0 || nr >= 100 && nr <= 1900 || nr > 2155) { |