@@ -6,6 +6,7 @@ extern crate postgres;
66extern crate collect;
77
88use collect:: LruCache ;
9+ use std:: borrow:: ToOwned ;
910use std:: cell:: RefCell ;
1011use std:: default:: Default ;
1112use std:: error;
@@ -202,6 +203,8 @@ pub struct Connection {
202203 stmts : * mut ( ) ,
203204}
204205
206+ unsafe impl Send for Connection { }
207+
205208impl 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
218221impl 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
255258impl < ' 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