-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any way to know if a connection is already inside a transaction? #28
Comments
To show a concrete very simple example: Suppose I have a global database connection
What would happen is that when I call
|
(Up front, I'm guessing you already know this, and are asking for a stub for each driver to implement the actual method.) It depends on the DBMS.
not sure about others ... |
Thanks. Yeah, I was more wondering about a generic DBI function that works across the different implementations |
I'd suggest to use If you need to interact with code that you don't control, and this code behaves erratically regarding transactions, that's tough. Can you DBI knows if |
I just found this thread when I was also attempting to determine if there is an active transaction. I use RSQlite/DBI and would love to have |
Thanks for the suggestions. I don't think this is a good fit for DBI at this time, please query the transaction status manually if you really need to. |
Ideally, every call to
dbBegin()
will be followed by exactly one call to either rollback or commit.However, sometimes in complex situations where the transaction is happening throughout several functions, it might not be 100% certain that a rollback is called in case of an error. In that case, the next time I try to call
dbBegin()
, I'd like to clear any active transactions because if a previous transaction failed part-way through then I'm stuck and cannot start a new transaction.To do this, it would be necessary to have a function such as
DBI::isActiveTransaction()
or similarThe text was updated successfully, but these errors were encountered: