Skip to content

Commit

Permalink
use execute_typed api
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm1 committed Nov 1, 2024
1 parent a5a7bd7 commit db8a787
Showing 1 changed file with 4 additions and 18 deletions.
22 changes: 4 additions & 18 deletions quaint/src/connector/postgres/native/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -729,15 +729,8 @@ impl Queryable for PostgreSql {
.collect();

let changes = self
.perform_io(self.client.0.query_typed_raw::<&(dyn ToSql + Sync), _>(
sql,
params_with_types.as_slice().iter()
.map(|(v, t)| (*v, t.clone()))
.collect::<Vec<_>>()
))
.await?
.rows_affected()
.unwrap_or(0);
.perform_io(self.client.0.execute_typed(sql, params_with_types.as_slice()))
.await?;

Ok(changes)
},
Expand All @@ -763,15 +756,8 @@ impl Queryable for PostgreSql {
.collect();

let changes = self
.perform_io(self.client.0.query_typed_raw::<&(dyn ToSql + Sync), _>(
sql,
params_with_types.as_slice().iter()
.map(|(v, t)| (*v, t.clone()))
.collect::<Vec<_>>()
))
.await?
.rows_affected()
.unwrap_or(0);
.perform_io(self.client.0.execute_typed(sql, params_with_types.as_slice()))
.await?;

Ok(changes)
},
Expand Down

0 comments on commit db8a787

Please sign in to comment.