Author: cito
Date: Sat May 12 15:51:05 2012
New Revision: 437
Log:
Roll back any open transaction when closing a connection (#46).
Modified:
trunk/docs/changelog.txt
trunk/module/pgdb.py
Modified: trunk/docs/changelog.txt
==============================================================================
--- trunk/docs/changelog.txt Tue May 8 06:36:04 2012 (r436)
+++ trunk/docs/changelog.txt Sat May 12 15:51:05 2012 (r437)
@@ -15,6 +15,9 @@
- Proper handling of floats with 'nan' or 'inf' values as input.
- Fixed the set_decimal() function.
- All DatabaseError instances now have a sqlstate attribute.
+- Open transactions are rolled back when pgdb connections are closed
+ (as suggested by Peter Harris).
+
Version 4.0 (2009-01-01)
------------------------
Modified: trunk/module/pgdb.py
==============================================================================
--- trunk/module/pgdb.py Tue May 8 06:36:04 2012 (r436)
+++ trunk/module/pgdb.py Sat May 12 15:51:05 2012 (r437)
@@ -449,6 +449,11 @@
def close(self):
"""Close the connection object."""
if self._cnx:
+ if self._tnx:
+ try:
+ self.rollback()
+ except DatabaseError:
+ pass
self._cnx.close()
self._cnx = None
else:
_______________________________________________
PyGreSQL mailing list
[email protected]
https://mail.vex.net/mailman/listinfo.cgi/pygresql