andialbrecht / crunchyfrog

Head over to RunSQLRun, the successor of CrunchyFrog
http://runsqlrun.org
GNU General Public License v3.0
4 stars 2 forks source link

Set internal disconnect status if connection is closed #51

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Closing an already closed connection via the navigator results in a
traceback (e.g. when the db server is stopped or if an timeout occured):

{{{
Traceback (most recent call last):
  File "/storage/devel/crunchyfrog/cf/ui/browser.py", line 286, in
on_object_tree_selection_changed
    server_info = obj.internal_connection.get_server_info()
  File "/storage/devel/crunchyfrog/cf/backends/postgres.py", line 166, in
get_server_info
    cur.execute("select version()")
psycopg2.OperationalError: breche Verbindung ab wegen Befehl vom Administrator
server closed the connection unexpectedly
    This probably means the server terminated abnormally
    before or while processing the request.

Traceback (most recent call last):
  File "/storage/devel/crunchyfrog/cf/ui/browser.py", line 157, in disconnect
    datasource_info.dbdisconnect()
  File "/storage/devel/crunchyfrog/cf/datasources.py", line 261, in
dbdisconnect
    conn.close()
  File "/storage/devel/crunchyfrog/cf/backends/dbapi2helper.py", line 72,
in close
    self._conn.close()
psycopg2.InterfaceError: connection already closed
}}}

Original issue reported on code.google.com by albrecht.andi on 16 Apr 2009 at 1:01

GoogleCodeExporter commented 9 years ago
DB-API2 doesn't provide a unified way to determine if a connection is still 
alive.
Anyway, if the connection is gone, an error message is displayed in the 
front-end.

Original comment by albrecht.andi on 20 May 2009 at 1:26