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
Hello, I am trying to write database agnostic application that would support Postgresql and Mysql/Mariadb and SQLite with where database would be defined before run so I've choosen AnyPool for this.
So far queries with MySqlPool and PgPool alone work without any issues, but AnyPool returns BLOB that can't be parsed into struct that I work with later in my code.
Error message:
err = ColumnDecode {
index: "\"locale_tag\"",
source: "mismatched types; Rust type `alloc::string::String` is not compatible with SQL type `BLOB`",
}
Minimal Reproduction
pub async fn get_locales(Extension(db): Extension<AnyPool>) -> Result<Json<Value>, AppError> {
let locales_query = sqlx::query_as::<_, Locales>(
"SELECT locale_tag, locale_name, locale_img, enabled FROM locales ORDER BY locale_tag ASC",
)
.fetch_all(&db)
.await
.map_err(|err| {
dbg!(err);
AppError::InternalServerError
})?;
// rest of the fn is not included here
}
#[derive(Serialize, Deserialize, sqlx::FromRow)]
pub struct Locales {
pub locale_tag: String,
pub locale_name: String,
pub locale_img: String,
pub enabled: bool,
}
Info
SQLx version: 0.8.2
SQLx features enabled: ["runtime-tokio-rustls", "postgres", "macros", "time", "json", "mysql", "any"]
Database server and version: MySQL (mariadb 10.11.10)
Bug Description
Hello, I am trying to write database agnostic application that would support Postgresql and Mysql/Mariadb and SQLite with where database would be defined before run so I've choosen AnyPool for this.
So far queries with MySqlPool and PgPool alone work without any issues, but AnyPool returns BLOB that can't be parsed into struct that I work with later in my code.
Error message:
Minimal Reproduction
Info
rustc --version
: rustc 1.82.0 (f6e511eec 2024-10-15)The text was updated successfully, but these errors were encountered: