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
A small code snippet or a link to a Github repo or Gist, with instructions on reproducing the bug.
[dependencies]
sqlx = { version = "0.7.4", features = ["any", "sqlite", "postgres", "mysql"] }
tokio = { version = "1.36.0", features = ["full"] }
use sqlx::{Any,Pool};#[tokio::main]asyncfnmain(){let pool:Pool<Any> = Pool::connect("sqlite::memory:").await.unwrap();let kind = pool.any_kind();}
Error:
error[E0599]: no method named `any_kind` found for struct `Pool` in the current scope
--> src/main.rs:6:21
|
6 | let kind = pool.any_kind();
| ^^^^^^^^ method not found in `Pool<Any>`
For more information about this error, try `rustc --explain E0599`.
Info
SQLx version: 0.7.4
SQLx features enabled: ["any", "sqlite", "postgres", "mysql"]
I have the same issue, found out that the compilation of any_kind() is gated behind some features in sqlx_core (sqlx-core/src/pool/mod.rs):
#[cfg(all( any( feature = "postgres", feature = "mysql", feature = "mssql", feature = "sqlite"), feature = "any"))]implPool<Any>{/// Returns the database driver currently in-use by this `Pool`.////// Determined by the connection URL.pubfnany_kind(&self) -> AnyKind{self.0.connect_options.read().expect("write-lock holder panicked").kind()}}
Turns out that the features postgres, mysql, mssql and sqlite have been removed during refactoring (#2039), as well as the kind() method on AnyConnectOptions.
Adding these features back in the sqlx_core crate and implementing the missing kind() method on AnyConnectOptions brings back any_kind(), though I don't know if it's the intended way to do it here (perhaps we could remove these feature flags alltogether?)
Bug Description
any_kind()
is not available inPool<Any>
in v0.7.Minimal Reproduction
A small code snippet or a link to a Github repo or Gist, with instructions on reproducing the bug.
Error:
Info
rustc --version
: rustc 1.77.0 (aedd173a2 2024-03-17)The text was updated successfully, but these errors were encountered: