From 50ea5c52cb9e041b344b249c82f9c278f2ebf184 Mon Sep 17 00:00:00 2001 From: Finn Bear Date: Wed, 29 Mar 2023 11:23:13 -0700 Subject: [PATCH] Fix #1732 - casting string containing decimal to int. (#1734) --- lib/src/sql/value/value.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/src/sql/value/value.rs b/lib/src/sql/value/value.rs index f9221420..8cef4141 100644 --- a/lib/src/sql/value/value.rs +++ b/lib/src/sql/value/value.rs @@ -803,7 +803,7 @@ impl Value { pub fn as_int(self) -> i64 { match self { Value::True => 1, - Value::Strand(v) => v.parse::().unwrap_or(0), + Value::Strand(v) => Number::from(v.as_str()).as_int(), Value::Number(v) => v.as_int(), Value::Duration(v) => v.as_secs() as i64, Value::Datetime(v) => v.timestamp(),