(&self, stmt: Statement)
| 336 | #[instrument(level = "trace")] |
| 337 | #[allow(unused_variables)] |
| 338 | async fn query_one(&self, stmt: Statement) -> Result<Option<QueryResult>, DbErr> { |
| 339 | debug_print!("{}", stmt); |
| 340 | |
| 341 | match &mut *self.conn.lock().await { |
| 342 | #[cfg(feature = "sqlx-mysql")] |
| 343 | InnerConnection::MySql(conn) => { |
| 344 | let query = crate::driver::sqlx_mysql::sqlx_query(&stmt); |
| 345 | let conn: &mut sqlx::MySqlConnection = &mut *conn; |
| 346 | crate::metric::metric!(self.metric_callback, &stmt, { |
| 347 | crate::sqlx_map_err_ignore_not_found( |
| 348 | query.fetch_one(conn).await.map(|row| Some(row.into())), |
| 349 | ) |
| 350 | }) |
| 351 | } |
| 352 | #[cfg(feature = "sqlx-postgres")] |
| 353 | InnerConnection::Postgres(conn) => { |
| 354 | let query = crate::driver::sqlx_postgres::sqlx_query(&stmt); |
| 355 | let conn: &mut sqlx::PgConnection = &mut *conn; |
| 356 | crate::metric::metric!(self.metric_callback, &stmt, { |
| 357 | crate::sqlx_map_err_ignore_not_found( |
| 358 | query.fetch_one(conn).await.map(|row| Some(row.into())), |
| 359 | ) |
| 360 | }) |
| 361 | } |
| 362 | #[cfg(feature = "sqlx-sqlite")] |
| 363 | InnerConnection::Sqlite(conn) => { |
| 364 | let query = crate::driver::sqlx_sqlite::sqlx_query(&stmt); |
| 365 | let conn: &mut sqlx::SqliteConnection = &mut *conn; |
| 366 | crate::metric::metric!(self.metric_callback, &stmt, { |
| 367 | crate::sqlx_map_err_ignore_not_found( |
| 368 | query.fetch_one(conn).await.map(|row| Some(row.into())), |
| 369 | ) |
| 370 | }) |
| 371 | } |
| 372 | #[cfg(feature = "mock")] |
| 373 | InnerConnection::Mock(conn) => return conn.query_one(stmt), |
| 374 | #[cfg(feature = "proxy")] |
| 375 | InnerConnection::Proxy(conn) => return conn.query_one(stmt).await, |
| 376 | #[allow(unreachable_patterns)] |
| 377 | _ => Err(conn_err("Disconnected")), |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | #[instrument(level = "trace")] |
| 382 | #[allow(unused_variables)] |
nothing calls this directly
no test coverage detected