@@ -78,7 +78,7 @@ use extra::ringbuf::RingBuf;
7878use extra:: url:: { UserInfo , Url } ;
7979use openssl:: crypto:: hash:: { MD5 , Hasher } ;
8080use openssl:: ssl:: { SslStream , SslContext } ;
81- use std:: cell:: RefCell ;
81+ use std:: cell:: { Cell , RefCell } ;
8282use std:: hashmap:: HashMap ;
8383use std:: io:: { BufferedStream , IoResult } ;
8484use std:: io:: net:: ip:: { Port , SocketAddr } ;
@@ -572,7 +572,7 @@ impl InnerPostgresConnection {
572572 name : stmt_name,
573573 param_types : param_types,
574574 result_desc : result_desc,
575- next_portal_id : RefCell :: new ( 0 )
575+ next_portal_id : Cell :: new ( 0 )
576576 } )
577577 }
578578
@@ -918,7 +918,7 @@ pub struct NormalPostgresStatement<'conn> {
918918 priv name : ~str ,
919919 priv param_types : ~[ PostgresType ] ,
920920 priv result_desc : ~[ ResultDescription ] ,
921- priv next_portal_id : RefCell < uint >
921+ priv next_portal_id : Cell < uint >
922922}
923923
924924#[ unsafe_destructor]
@@ -984,7 +984,8 @@ impl<'conn> NormalPostgresStatement<'conn> {
984984
985985 fn try_lazy_query < ' a > ( & ' a self , row_limit : uint , params : & [ & ToSql ] )
986986 -> Result < PostgresResult < ' a > , PostgresError > {
987- let id = self . next_portal_id . with_mut ( |x| { * x += 1 ; * x - 1 } ) ;
987+ let id = self . next_portal_id . get ( ) ;
988+ self . next_portal_id . set ( id + 1 ) ;
988989 let portal_name = format ! ( "{}_portal_{}" , self . name, id) ;
989990
990991 if_ok ! ( self . execute( portal_name, row_limit, params) ) ;
0 commit comments