File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,6 +85,22 @@ FieldSet::fieldtype FieldSet::detect(const std::string& str)
8585 }
8686 }
8787 }
88+ // skip double exponent and iterate over digits
89+ else if (it != str.end () && (*it == ' e' || *it == ' E' ))
90+ {
91+ ++it;
92+
93+ // skip sign
94+ if (it != str.end () && (*it == ' +' || *it == ' -' )) ++it;
95+
96+ // iterate over digits
97+ while (it != str.end () && isdigit (*it)) ++it;
98+
99+ if (it == str.end () && it != str.begin ()) {
100+ return T_DOUBLE;
101+ }
102+
103+ }
88104
89105 return T_VARCHAR;
90106}
@@ -95,6 +111,7 @@ void FieldSet::check_detect()
95111 assert ( detect (" 1234" ) == T_INTEGER );
96112 assert ( detect (" 1234.3" ) == T_DOUBLE );
97113 assert ( detect (" .3e-3" ) == T_DOUBLE );
114+ assert ( detect (" 5e-05" ) == T_DOUBLE );
98115 assert ( detect (" 1234,3" ) == T_VARCHAR );
99116 assert ( detect (" sdfdf" ) == T_VARCHAR );
100117}
You can’t perform that action at this time.
0 commit comments