You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Edit: the one SQLite example was not updated to dereference PoolConnection, leading to this error. It should just be updated to use .execute(&mut *conn).
The execute/fetch_one/fetch_all etc. functions throw compile-time errors when using PoolConnection on main. Edit: they just need to be dereferenced.
I'm guessing this is known, and is why the examples were removed from the workspace Cargo.toml for the 0.7.0-alpha.1 merge to main.
letmut conn:PoolConnection<Sqlite> = pool.acquire().await?;// Insert the task, then obtain the ID of this rowlet id = sqlx::query!(r#"INSERT INTO todos ( description )VALUES ( ?1 ) "#,
description
).execute(&mut conn).await?
.last_insert_rowid();
Error:
error[E0277]: the trait bound `&mut sqlx::pool::PoolConnection<Sqlite>:Executor<'_>` is not satisfied
--> examples/sqlite/todos/src/main.rs:60:14
|
60 | .execute(&mut conn)
| ------- ^^^^^^^^^ the trait `Executor<'_>` is not implemented for `&mut sqlx::pool::PoolConnection<Sqlite>`
| |
| required by a bound introduced by this call
|
= help: the following other types implement trait `Executor<'c>`:
<&'cmutAnyConnectionasExecutor<'c>>
<&'cmutSqliteConnectionasExecutor<'c>>
<&Pool<DB>asExecutor<'p>>
note: required by a bound in `Query::<'q,DB,A>::execute`
--> /sqlx/sqlx-core/src/query.rs:151:12
|
151 | E:Executor<'c,Database = DB>,
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Query::<'q,DB,A>::execute`
The Executor impls for Transaction and PoolConnection have been deleted because they cannot exist in the new crate architecture without rewriting the Executor trait entirely.
To fix this breakage, simply add a dereference where an impl Executor is expected, as they both dereference to the inner connection type which will still implement it:
Yeah, I didn't update the examples for the alpha because I just wanted to get CI passing and get the release out. I forgot how many we had, heh. That'll be part of preparing the full release which I will try to get out next week if nothing else comes up.
Bug Description
Edit: the one SQLite example was not updated to dereference
PoolConnection
, leading to this error. It should just be updated to use.execute(&mut *conn)
.The
execute
/fetch_one
/fetch_all
etc. functions throw compile-time errors when usingPoolConnection
onmain
. Edit: they just need to be dereferenced.I'm guessing this is known, and is why the examples were removed from the workspaceCargo.toml
for the0.7.0-alpha.1
merge tomain
.Minimal Reproduction
The SQLite TODOs example in the repository.
Error:
Info
main
branch, commit f05c884)["sqlite", "runtime-tokio-native-tls"]
rustc --version
: rustc 1.67.1 (d5a82bbd2 2023-02-07)The text was updated successfully, but these errors were encountered: