diff --git a/lib/game-database-backend/Cargo.toml b/lib/game-database-backend/Cargo.toml index 73fab28..4a9e002 100644 --- a/lib/game-database-backend/Cargo.toml +++ b/lib/game-database-backend/Cargo.toml @@ -9,6 +9,9 @@ game-database = { path = "../../lib/game-database", default-features = false } ddnet-account-sql = { version = "0.3.0", default-features = false } +# when updating to the next major version check if +# https://github.com/launchbadge/sqlx/issues/3387 is fixed +# and remove the workaround in the code sqlx = { version = "0.8.2", features = ["runtime-tokio-rustls", "chrono"] } anyhow = { version = "1.0.95", features = ["backtrace"] } async-trait = "0.1.83" diff --git a/lib/game-database-backend/src/lib.rs b/lib/game-database-backend/src/lib.rs index 2b63378..f6294a5 100644 --- a/lib/game-database-backend/src/lib.rs +++ b/lib/game-database-backend/src/lib.rs @@ -121,7 +121,15 @@ impl GameDbBackend { DbType::F64(_) => DbType::F64(row.try_get::(name.as_str())?), DbType::Bool(_) => DbType::Bool(row.try_get::(name.as_str())?), DbType::String(_) => { - DbType::String(row.try_get::(name.as_str())?) + DbType::String(row.try_get::(name.as_str()).or_else( + |_| { + // workaround for strings with binary collation + // https://github.com/launchbadge/sqlx/issues/3387 + anyhow::Ok(String::from_utf8( + row.try_get::, _>(name.as_str())?, + )?) + }, + )?) } DbType::Vec(_) => { DbType::Vec(row.try_get::, _>(name.as_str())?)