On Thursday, September 25, 2003, at 05:11 PM, Sidnei da Silva wrote:
> I've been having some trouble with the fact that releaseConnection
> does a rollback() if autoCommit is false and not 'exception' and
> supportTransactions is set to True. Namely, if in my application (Zope
> 3-based) I've set autoCommit to false because Zope takes care of
> commiting the transaction at the right time, but then it reaches this
> path and anything that I do gets rolled back. So, the solution for me
> was to set supportTransactions to False, which doesn't seem to affect
> anything, but feels icky anyway. Is there any special reason for the
> rollback() there? The line in question is 98 of DBConnection.
Looking at that again, I don't know that the code is really correct.
The difficulty is that objects should know when they are rolled back.
I know ZODB handles this as well; I'm not as clear about how that fits
into SQLObject. Specifically, Transaction.rollback expires all the
instances so that invalid cached values are removed.
So, I don't know if the current behavior is really right, but I don't
think removing it is quite right either. Though it may be appropriate
to set supportTransactions to false, because in a Zope environment the
transactions are being handled by Zope, not by SQLObject. Though Zope
is not always the final work on transactions either -- it's sometimes
necessary to commit or rollback transactions in the middle of a
request. So that has to be factored in too. So, in summary, I'm not
sure.
Ian
|