You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have the following situation (dummy commands to explain the point):
letmut tx = conn.start_transaction(TxOpts::default())?;
tx.query_drop("SELECT 1");
tx.commit();// All ok! I continue to perform operations after the transaction is committed.
conn.query_drop("SELECT 1");
Now the problem is that I wanted to encapsulate some common functionality, so I need to pass the tx and conn variables and ended up with:
The problem is that this does not work because conn is already mutably borrowed in tx.
Is there a solution to this problem?
AFAIK it is not possible to reuse the Transaction tx after commit/rollback. From what I can tell, this could be solved if I could retrieve the connection again after transaction is dropped.
Something like the following would fix my problem:
Hi!
I have the following situation (dummy commands to explain the point):
Now the problem is that I wanted to encapsulate some common functionality, so I need to pass the tx and conn variables and ended up with:
The problem is that this does not work because
conn
is already mutably borrowed in tx.Is there a solution to this problem?
AFAIK it is not possible to reuse the Transaction tx after commit/rollback. From what I can tell, this could be solved if I could retrieve the connection again after transaction is dropped.
Something like the following would fix my problem:
Is this already possible? Am I trying to do something that I shouldn't do? Is this is a simply an API oversight?
Of course rust-mysql would need to implement both
commit_with_connection
androllback_with_connection
.Cheers
The text was updated successfully, but these errors were encountered: