@@ -53,9 +53,9 @@ use crate::{
53
53
} ;
54
54
use crate :: { resolve_ext_path, Connection , Result , TransactionState , DATABASE_VERSION } ;
55
55
use insn:: {
56
- exec_add, exec_and, exec_bit_and, exec_bit_not, exec_bit_or, exec_boolean_not , exec_concat ,
57
- exec_divide , exec_multiply , exec_or , exec_remainder , exec_shift_left , exec_shift_right ,
58
- exec_subtract, Cookie ,
56
+ cast_text_to_numerical , exec_add, exec_and, exec_bit_and, exec_bit_not, exec_bit_or,
57
+ exec_boolean_not , exec_concat , exec_divide , exec_multiply , exec_or , exec_remainder ,
58
+ exec_shift_left , exec_shift_right , exec_subtract, Cookie ,
59
59
} ;
60
60
use likeop:: { construct_like_escape_arg, exec_glob, exec_like_with_escape} ;
61
61
use rand:: distributions:: { Distribution , Uniform } ;
@@ -3580,15 +3580,7 @@ fn exec_cast(value: &OwnedValue, datatype: &str) -> OwnedValue {
3580
3580
let text = String :: from_utf8_lossy ( b) ;
3581
3581
cast_text_to_numeric ( & text)
3582
3582
}
3583
- OwnedValue :: Text ( t) => {
3584
- let text = t. as_str ( ) ;
3585
- // Looks like a float
3586
- if text. contains ( '.' ) || text. contains ( 'e' ) || text. contains ( 'E' ) {
3587
- cast_text_to_real ( text)
3588
- } else {
3589
- cast_text_to_integer ( text)
3590
- }
3591
- }
3583
+ OwnedValue :: Text ( t) => cast_text_to_numerical ( t. as_str ( ) ) ,
3592
3584
OwnedValue :: Integer ( i) => OwnedValue :: Integer ( * i) ,
3593
3585
OwnedValue :: Float ( f) => OwnedValue :: Float ( * f) ,
3594
3586
_ => value. clone ( ) , // TODO probably wrong
0 commit comments