Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
SQLx 0.5
Browse files Browse the repository at this point in the history
  • Loading branch information
Julius de Bruijn committed Jul 27, 2020
1 parent 7c70755 commit a79eb9f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ indoc = "0.3"
names = "0.11"

[dependencies.sqlx]
git = "https://github.com/pimeys/sqlx"
path = "../sqlx"
branch = "work-branch"
default_features = false
features = ["decimal", "json", "chrono", "ipnetwork", "bit-vec"]
Expand Down
13 changes: 5 additions & 8 deletions src/connector/postgres/conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ use rust_decimal::{
#[cfg(feature = "chrono-0_4")]
use sqlx::postgres::types::PgTimeTz;
use sqlx::{
postgres::{
types::{PgAny, PgMoney},
PgArguments, PgRow, PgTypeInfo,
},
postgres::{types::PgMoney, PgArguments, PgRow, PgTypeInfo},
query::Query,
types::Json,
Column, Postgres, Row, TypeInfo,
Expand Down Expand Up @@ -95,10 +92,10 @@ impl<'a> Bind<'a, Postgres> for Query<'a, Postgres, PgArguments> {
None => self.bind(Option::<sqlx::types::ipnetwork::IpNetwork>::None),
},
(Value::Text(c), _) if type_info.map(|ti| ti.is_enum()).unwrap_or(false) => {
self.bind(c.map(|c| PgAny(c.into_owned())))
self.bind(c.map(|c| c.into_owned()))
}
(Value::Text(c), _) => self.bind(c.map(|c| c.into_owned())),
(Value::Enum(c), _) => self.bind(c.map(|c| PgAny(c.into_owned()))),
(Value::Enum(c), _) => self.bind(c.map(|c| c.into_owned())),

(Value::Bytes(c), _) => self.bind(c.map(|c| c.into_owned())),
(Value::Boolean(b), _) => self.bind(b),
Expand Down Expand Up @@ -659,7 +656,7 @@ impl<'a> Bind<'a, Postgres> for Query<'a, Postgres, PgArguments> {
for val in ary.into_iter().map(|v| v.into_string()) {
match val {
Some(val) => {
vals.push(PgAny(val));
vals.push(val);
}
None => {
let msg = "Non-string parameter when storing a string array";
Expand All @@ -670,7 +667,7 @@ impl<'a> Bind<'a, Postgres> for Query<'a, Postgres, PgArguments> {
}
}

self.bind(PgAny(vals))
self.bind(vals)
}
None => self.bind(Option::<Vec<String>>::None),
},
Expand Down

0 comments on commit a79eb9f

Please sign in to comment.