mirror of
https://github.com/element-hq/synapse.git
synced 2026-08-18 04:20:32 +00:00
Introduce a small enum-based layer so simple queries can be written once regardless of backend: DbPool/DbConn dispatch over each backend's own pool, and DbConn::query(sql, params) binds positional `?` placeholders and returns rows as backend-agnostic DbValue cells (read out with DbRowExt::try_get). No trait/async_trait machinery — a closed enum keeps the pool.get().await? / conn.query(...).await? surface simple. The Postgres arm rewrites `?` to `$1, $2, ...` (matching convert_param_style), reuses PgValue for parameter binding, and adds a Rust-native DbValueFromSql decoder (the non-Python counterpart of PythonPgFromSql). The shared column-type list is factored into accepts_column_type so the three mappings can't drift. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>