sqlx/tests/sqlite/any.rs
Austin Bonander 90797200ee
groundwork for 0.9.0-alpha.1 (#3821)
* chore: bump version to `0.9.0-alpha.1`

* chore: delete unused `sqlx-bench` package

* chore: set `rust-version` to 1.85 for all crates

* fix: lots of new Clippy warnings

* fix: lots more Clippy warnings

* fix(cli): add `_sqlite` feature

* fix: lots, *lots* more Clippy warnings

* fix(core): warning in `tls_rustls`

* breaking: delete runtime+TLS combination features

* chore: don't re-export unstable `TransactionManager` trait

* chore: 0.9.0-alplha.1 CHANGELOG

* chore: increase MSRV further to 1.86

* fix: more clippy warnings
2025-06-01 21:09:55 -07:00

36 lines
903 B
Rust

use sqlx::Any;
use sqlx_test::new;
#[sqlx_macros::test]
async fn it_encodes_bool_with_any() -> anyhow::Result<()> {
sqlx::any::install_default_drivers();
let mut conn = new::<Any>().await?;
let res = sqlx::query("INSERT INTO accounts (name, is_active) VALUES (?, ?)")
.bind("Harrison Ford")
.bind(true)
.execute(&mut conn)
.await
.expect("failed to encode bool");
assert_eq!(res.rows_affected(), 1);
Ok(())
}
#[sqlx_macros::test]
async fn issue_3179() -> anyhow::Result<()> {
sqlx::any::install_default_drivers();
let mut conn = new::<Any>().await?;
// 4294967297 = 2^32
let number: i64 = sqlx::query_scalar("SELECT 4294967296")
.fetch_one(&mut conn)
.await?;
// Previously, the decoding would use `i32` as an intermediate which would overflow to 0.
assert_eq!(number, 4294967296);
Ok(())
}