Skip to content

Commit

Permalink
sqlite: decimal_text
Browse files Browse the repository at this point in the history
  • Loading branch information
billy1624 committed Jan 23, 2024
1 parent e8d230d commit 93d61a7
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 2 additions & 6 deletions sea-query-binder/src/sqlx_sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,12 @@ impl<'q> sqlx::IntoArguments<'q, sqlx::sqlite::Sqlite> for SqlxValues {
#[cfg(feature = "with-rust_decimal")]
Value::Decimal(decimal) => {
use rust_decimal::prelude::ToPrimitive;
args.add(
decimal.map(|d| d.to_f64().expect("Fail to convert rust_decimal as f64")),
);
args.add(decimal.map(|d| d.to_string()));
}
#[cfg(feature = "with-bigdecimal")]
Value::BigDecimal(big_decimal) => {
use bigdecimal::ToPrimitive;
args.add(
big_decimal.map(|d| d.to_f64().expect("Fail to convert bigdecimal as f64")),
);
args.add(big_decimal.map(|d| d.to_string()));
}
#[cfg(feature = "with-json")]
Value::Json(j) => {
Expand Down
4 changes: 2 additions & 2 deletions src/backend/sqlite/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ impl SqliteQueryBuilder {
ColumnType::Float => "float".into(),
ColumnType::Double => "double".into(),
ColumnType::Decimal(precision) => match precision {
Some((precision, scale)) => format!("decimal({precision}, {scale})"),
None => "decimal".into(),
Some((precision, scale)) => format!("decimal_text({precision}, {scale})"),
None => "decimal_text".into(),
},
ColumnType::DateTime => "datetime_text".into(),
ColumnType::Timestamp => "timestamp_text".into(),
Expand Down

0 comments on commit 93d61a7

Please sign in to comment.