Re: conn.close() idempotence

Federico Di Gregorio <[email protected]>
Newsgroups gmane.comp.python.db
Message-ID <[email protected]>
On 19/10/11 09:59, M.-A. Lemburg wrote:
[snip]
>> risks to become a problem, with the close() that may raise an error
>> > because the connection has been implicitly closed by a communication
>> > error. Note that close() in itself often is a quite safe operation,
>> > not involving database communication, so it is not expected to fail
>> > and may not be well guarded.
> That last sentence is not quite correct: .close() issues an implicit
> .rollback() and usually also tells the database backend to free up
> resources maintained for the connection, so it does require communication
> with the backend.

Here is the problem. Does .close() always issue an implicit .rollback()?
The DBAPI says yes but, as noted previously, the driver can choose to
NOT send a rollback. In fact on the second .close() the driver SHOULD
NOT send a rollback because there is no transaction in progress.

I'd vote for idempotent .close() interpretation too.

federico

-- 
Federico Di Gregorio                                       [email protected]
              Una nazionale senza neanche una nazione. -- macchinavapore

_______________________________________________
DB-SIG maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/db-sig
signature.asc (application/pgp-signature, 262 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6ehRwACgkQvcCgrgZGjesLngCfZWkRZN4XUiTOWC1Qy27/5uU3
jNUAniycfjwATT0ch/8UuD4MMEYJIH4i
=TemT
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.