On Tue, May 30, 2017 at 8:19 AM, Joseph L. Casale
<jcas...@activenetwerx.com> wrote:
> -----Original Message-----
> From: Python-list [mailto:python-list-
> bounces+jcasale=activenetwerx....@python.org] On Behalf Of Ian Kelly
> Sent: Tuesday, May 30, 2017 8:12 AM
> To: Python <python-list@python.org>
> Subject: Re: Python DB API - commit() v. execute("commit transaction")?
>
>> There's no difference I'm aware of in the implementations I've used,
>> but having a consistent API does allow for constructions such as:
>>
>> try:
>>     do_stuff(conn)
>> except:
>>     conn.rollback()
>> finally:
>>     conn.commit()
>
> So you always commit even after an exception?

Doh, that finally should have been else. Though to be fair, committing
immediately after rolling back should be harmless if there are no
other threads using the same connection.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to