File tree Expand file tree Collapse file tree 3 files changed +88
-138
lines changed Expand file tree Collapse file tree 3 files changed +88
-138
lines changed Original file line number Diff line number Diff line change @@ -62,15 +62,18 @@ impl RustConnection {
6262 ) -> Transaction {
6363 let inner_transaction = RustTransaction :: new (
6464 self . db_client . clone ( ) ,
65- Arc :: new ( tokio :: sync :: RwLock :: new ( false ) ) ,
66- Arc :: new ( tokio :: sync :: RwLock :: new ( false ) ) ,
65+ false ,
66+ false ,
6767 Arc :: new ( tokio:: sync:: RwLock :: new ( HashSet :: new ( ) ) ) ,
6868 isolation_level,
6969 read_variant,
7070 deferrable,
7171 ) ;
7272
73- Transaction :: new ( Arc :: new ( inner_transaction) , Default :: default ( ) )
73+ Transaction :: new (
74+ Arc :: new ( tokio:: sync:: RwLock :: new ( inner_transaction) ) ,
75+ Default :: default ( ) ,
76+ )
7477 }
7578}
7679
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ use super::transaction::RustTransaction;
1818pub struct InnerCursor {
1919 querystring : String ,
2020 parameters : Vec < PythonDTO > ,
21- db_transaction : Arc < RustTransaction > ,
21+ db_transaction : Arc < tokio :: sync :: RwLock < RustTransaction > > ,
2222 cursor_name : String ,
2323 fetch_number : usize ,
2424 scroll : Option < bool > ,
@@ -29,7 +29,7 @@ pub struct InnerCursor {
2929impl InnerCursor {
3030 #[ must_use]
3131 pub fn new (
32- db_transaction : Arc < RustTransaction > ,
32+ db_transaction : Arc < tokio :: sync :: RwLock < RustTransaction > > ,
3333 querystring : String ,
3434 parameters : Vec < PythonDTO > ,
3535 cursor_name : String ,
@@ -75,6 +75,8 @@ impl InnerCursor {
7575 cursor_init_query. push_str ( format ! ( " CURSOR FOR {}" , self . querystring) . as_str ( ) ) ;
7676
7777 db_transaction_arc
78+ . read ( )
79+ . await
7880 . inner_execute ( cursor_init_query, & self . parameters )
7981 . await ?;
8082
@@ -98,6 +100,8 @@ impl InnerCursor {
98100 }
99101
100102 db_transaction_arc
103+ . read ( )
104+ . await
101105 . inner_execute ( format ! ( "CLOSE {}" , self . cursor_name) , vec ! [ ] )
102106 . await ?;
103107
@@ -121,6 +125,8 @@ impl InnerCursor {
121125 }
122126
123127 let result = db_transaction_arc
128+ . read ( )
129+ . await
124130 . inner_execute_raw ( querystring, vec ! [ ] )
125131 . await ?;
126132
You can’t perform that action at this time.
0 commit comments