Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Never read bigdecimals from SQLite
Browse files Browse the repository at this point in the history
  • Loading branch information
Julius de Bruijn committed May 18, 2021
1 parent b25718d commit 2bee954
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 37 deletions.
Binary file modified db/test.db
Binary file not shown.
6 changes: 0 additions & 6 deletions src/connector/sqlite/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,6 @@ impl<'a> GetRow for SqliteRow<'a> {
}
_ => Value::integer(i),
},
#[cfg(feature = "bigdecimal")]
ValueRef::Real(f) if column.is_real() => {
use bigdecimal::{BigDecimal, FromPrimitive};

Value::numeric(BigDecimal::from_f64(f).unwrap())
}
ValueRef::Real(f) => Value::double(f),
#[cfg(feature = "chrono")]
ValueRef::Text(bytes) if column.is_datetime() => {
Expand Down
32 changes: 1 addition & 31 deletions src/tests/types/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::tests::test_api::sqlite_test_api;
use crate::tests::test_api::TestApi;
#[cfg(feature = "chrono")]
use crate::{ast::*, connector::Queryable};
#[cfg(feature = "bigdecimal")]
#[cfg(feature = "chrono")]
use std::str::FromStr;

test_type!(integer(
Expand All @@ -20,36 +20,6 @@ test_type!(integer(
Value::integer(i64::MAX)
));

#[cfg(feature = "bigdecimal")]
test_type!(real(
sqlite,
"REAL",
Value::Numeric(None),
Value::numeric(bigdecimal::BigDecimal::from_str("1.12345").unwrap())
));

#[cfg(feature = "bigdecimal")]
test_type!(float_decimal(
sqlite,
"FLOAT",
(Value::Numeric(None), Value::Float(None)),
(
Value::numeric(bigdecimal::BigDecimal::from_str("3.14").unwrap()),
Value::double(3.14)
)
));

#[cfg(feature = "bigdecimal")]
test_type!(double_decimal(
sqlite,
"DOUBLE",
(Value::Numeric(None), Value::Double(None)),
(
Value::numeric(bigdecimal::BigDecimal::from_str("3.14").unwrap()),
Value::double(3.14)
)
));

test_type!(text(sqlite, "TEXT", Value::Text(None), Value::text("foobar huhuu")));

test_type!(blob(
Expand Down

0 comments on commit 2bee954

Please sign in to comment.