File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1126,8 +1126,15 @@ impl Connection {
11261126 self . batch_execute ( level. to_set_query ( ) )
11271127 }
11281128
1129- /// Returns the isolation level which will be used for future transactions.
1129+ /// # Deprecated
1130+ ///
1131+ /// Use `transaction_isolation` instead.
11301132 pub fn get_transaction_isolation ( & self ) -> Result < IsolationLevel > {
1133+ self . transaction_isolation ( )
1134+ }
1135+
1136+ /// Returns the isolation level which will be used for future transactions.
1137+ pub fn transaction_isolation ( & self ) -> Result < IsolationLevel > {
11311138 let mut conn = self . conn . borrow_mut ( ) ;
11321139 check_desync ! ( conn) ;
11331140 let result = try!( conn. quick_query ( "SHOW TRANSACTION ISOLATION LEVEL" ) ) ;
Original file line number Diff line number Diff line change @@ -950,13 +950,13 @@ fn url_encoded_password() {
950950#[ test]
951951fn test_transaction_isolation_level ( ) {
952952 let conn = or_panic ! ( Connection :: connect( "postgres://postgres@localhost" , & SslMode :: None ) ) ;
953- assert_eq ! ( IsolationLevel :: ReadCommitted , or_panic!( conn. get_transaction_isolation ( ) ) ) ;
953+ assert_eq ! ( IsolationLevel :: ReadCommitted , or_panic!( conn. transaction_isolation ( ) ) ) ;
954954 or_panic ! ( conn. set_transaction_isolation( IsolationLevel :: ReadUncommitted ) ) ;
955- assert_eq ! ( IsolationLevel :: ReadUncommitted , or_panic!( conn. get_transaction_isolation ( ) ) ) ;
955+ assert_eq ! ( IsolationLevel :: ReadUncommitted , or_panic!( conn. transaction_isolation ( ) ) ) ;
956956 or_panic ! ( conn. set_transaction_isolation( IsolationLevel :: RepeatableRead ) ) ;
957- assert_eq ! ( IsolationLevel :: RepeatableRead , or_panic!( conn. get_transaction_isolation ( ) ) ) ;
957+ assert_eq ! ( IsolationLevel :: RepeatableRead , or_panic!( conn. transaction_isolation ( ) ) ) ;
958958 or_panic ! ( conn. set_transaction_isolation( IsolationLevel :: Serializable ) ) ;
959- assert_eq ! ( IsolationLevel :: Serializable , or_panic!( conn. get_transaction_isolation ( ) ) ) ;
959+ assert_eq ! ( IsolationLevel :: Serializable , or_panic!( conn. transaction_isolation ( ) ) ) ;
960960 or_panic ! ( conn. set_transaction_isolation( IsolationLevel :: ReadCommitted ) ) ;
961- assert_eq ! ( IsolationLevel :: ReadCommitted , or_panic!( conn. get_transaction_isolation ( ) ) ) ;
961+ assert_eq ! ( IsolationLevel :: ReadCommitted , or_panic!( conn. transaction_isolation ( ) ) ) ;
962962}
You can’t perform that action at this time.
0 commit comments