Re: Allow commit() without transaction?
On 12-04-2021 14:07, Nikita Popov wrote:
> I believe this behavior is correct, but I could see an argument made in
> favor of always allowing commit() calls (but not rollBack() calls) even if
> there is no active transaction. That would change the meaning of commit()
> from "commit an active transaction" towards "commit if an active
> transaction exists".
>
> Any opinions on that?
>
I think it is really nice that commit() throws for inactive
transactions. Code paths that mess up your transactions will not go
unnoticed that easily.
My preference would be to have a separate commit method or a method
parameter to explicitly allow committing without an active transaction.
Regards,
Dik Takken
Thread (6 messages)