bh: thuban/Thuban/Model postgisdb.py,1.19,1.20
cvs@intevation.de
cvs at intevation.de
Mon May 9 20:12:14 CEST 2005
Author: bh
Update of /thubanrepository/thuban/Thuban/Model
In directory doto:/tmp/cvs-serv3514/Thuban/Model
Modified Files:
postgisdb.py
Log Message:
* Thuban/Model/postgisdb.py (PostGISConnection.connect): Set the
connection to autoconnect. Fixes RT#3148.
* test/test_postgis_db.py
(TestPostGISSpecialCases.test_simple_error_handling): New test
that attempts to reproduce RT#3148.
Index: postgisdb.py
===================================================================
RCS file: /thubanrepository/thuban/Thuban/Model/postgisdb.py,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -d -r1.19 -r1.20
--- postgisdb.py 16 Dec 2004 15:18:57 -0000 1.19
+++ postgisdb.py 9 May 2005 18:12:12 -0000 1.20
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2004 by Intevation GmbH
+# Copyright (C) 2003, 2004, 2005 by Intevation GmbH
# Authors:
# Martin Mueller <mmueller at intevation.de>
# Bernhard Herzog <bh at intevation.de>
@@ -106,6 +106,16 @@
self.connection = psycopg.connect(" ".join(params))
except psycopg.OperationalError, val:
raise ConnectionError(str(val))
+
+ # Use autocommit mode. For simple reading of the database it's
+ # sufficient and we don't have to care much about error
+ # handling. Without autocommit, an errors during a cursor's
+ # execute method requires a rollback on the connection,
+ # otherwise later queries with the same or other cursors sharing
+ # the same connection will lead to further errors ("ERROR:
+ # current transaction is aborted, commands ignored until end of
+ # transaction block")
+ self.connection.autocommit()
# determine the OID for the geometry type. This is PostGIS
# specific.
More information about the Thuban-devel
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)