mirror of
https://github.com/launchbadge/sqlx
synced 2024-11-10 06:24:16 +00:00
sqlite test - prepared statements are reset after fetch_one
This commit is contained in:
parent
25858fc42a
commit
8328f893e4
1 changed files with 19 additions and 0 deletions
|
@ -485,3 +485,22 @@ async fn it_can_prepare_then_execute() -> anyhow::Result<()> {
|
|||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[sqlx_macros::test]
|
||||
async fn it_resets_prepared_statement_after_fetch_one() -> anyhow::Result<()> {
|
||||
let mut conn = new::<Sqlite>().await?;
|
||||
|
||||
conn.execute("CREATE TEMPORARY TABLE foobar (id INTEGER)")
|
||||
.await?;
|
||||
conn.execute("INSERT INTO foobar VALUES (42)").await?;
|
||||
|
||||
let r = sqlx::query("SELECT id FROM foobar")
|
||||
.fetch_one(&mut conn)
|
||||
.await?;
|
||||
let x: i32 = r.try_get("id")?;
|
||||
assert_eq!(x, 42);
|
||||
|
||||
conn.execute("DROP TABLE foobar").await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue