Skip to content

Commit 55513d3

Browse files
committed
Fix for upstream changes
1 parent 09590e5 commit 55513d3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ path = "tests/test.rs"
1919

2020
[dependencies]
2121
r2d2 = "0.2"
22-
postgres = "0.2"
22+
postgres = "0.4"
2323
collect = "~0.0"

src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ extern crate postgres;
66
extern crate collect;
77

88
use collect::LruCache;
9+
use std::borrow::ToOwned;
910
use std::cell::RefCell;
1011
use std::default::Default;
1112
use std::error;
@@ -202,6 +203,8 @@ pub struct Connection {
202203
stmts: *mut (),
203204
}
204205

206+
unsafe impl Send for Connection {}
207+
205208
impl Drop for Connection {
206209
fn drop(&mut self) {
207210
let _: Box<RefCell<LruCache<String, Rc<postgres::Statement<'static>>>>> =
@@ -217,7 +220,7 @@ impl Connection {
217220

218221
impl GenericConnection for Connection {
219222
fn prepare<'a>(&'a self, query: &str) -> postgres::Result<Rc<postgres::Statement<'a>>> {
220-
let query = query.into_string();
223+
let query = query.to_owned();
221224
let mut stmts = self.get_cache().borrow_mut();
222225

223226
if let Some(stmt) = stmts.get(&query) {
@@ -254,7 +257,7 @@ pub struct Transaction<'a> {
254257

255258
impl<'a> GenericConnection for Transaction<'a> {
256259
fn prepare<'b>(&'b self, query: &str) -> postgres::Result<Rc<postgres::Statement<'b>>> {
257-
let query = query.into_string();
260+
let query = query.to_owned();
258261
let mut stmts = self.conn.get_cache().borrow_mut();
259262

260263
if let Some(stmt) = stmts.get(&query) {

0 commit comments

Comments
 (0)