File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -1126,8 +1126,15 @@ impl Connection {
1126
1126
self . batch_execute ( level. to_set_query ( ) )
1127
1127
}
1128
1128
1129
- /// Returns the isolation level which will be used for future transactions.
1129
+ /// # Deprecated
1130
+ ///
1131
+ /// Use `transaction_isolation` instead.
1130
1132
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 > {
1131
1138
let mut conn = self . conn . borrow_mut ( ) ;
1132
1139
check_desync ! ( conn) ;
1133
1140
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() {
950
950
#[ test]
951
951
fn test_transaction_isolation_level ( ) {
952
952
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 ( ) ) ) ;
954
954
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 ( ) ) ) ;
956
956
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 ( ) ) ) ;
958
958
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 ( ) ) ) ;
960
960
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 ( ) ) ) ;
962
962
}
You can’t perform that action at this time.
0 commit comments