Closed tchaloupka closed 7 years ago
So this could happen whenever an exception is thrown within a method of Statement, couldn't it? This would mean that the statement has to be reset before throwing exceptions in other methods.
You are right. I'll get back to this after vacation. It's this bug for reference: https://issues.dlang.org/show_bug.cgi?id=14246 Fixed in dmd-2.075.0
I forgot this completely :) Until today when I again was hit by this on dmd-2.076.0 again. Looked at the original issue and realized that the fix was reverted and issue reopened.
If I understood this correctly, the only problem is when new structs constructor is called and throws, the structs destructor is not called then. Which is leading to hanging statement reference in this case. Other methods should be fine throwing.
I've looked in the code where Statement is used in the constructor and found only this occurance. So this seems to me good to go.
Actually I think that used statement reset is not needed at all. It just need to not store the statement before exception is thrown.
Fount this in our multithread app when on
it can throw exception because of database is locked by other thread
But after that if one retry the call to the db, it ends up with
error: cannot commit transaction - SQL statements in progress
.I found that it is because previous statement of
BEGIN IMMEDIATE
was not cleared. With this change, it seems to work.