[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7476 - trunk/gnue-common/src/datasources
From: |
reinhard |
Subject: |
[gnue] r7476 - trunk/gnue-common/src/datasources |
Date: |
Sun, 24 Apr 2005 05:59:34 -0500 (CDT) |
Author: reinhard
Date: 2005-04-24 05:59:32 -0500 (Sun, 24 Apr 2005)
New Revision: 7476
Modified:
trunk/gnue-common/src/datasources/GConnections.py
Log:
Fix for reusing connections that have not been opened before.
Modified: trunk/gnue-common/src/datasources/GConnections.py
===================================================================
--- trunk/gnue-common/src/datasources/GConnections.py 2005-04-23 13:57:13 UTC
(rev 7475)
+++ trunk/gnue-common/src/datasources/GConnections.py 2005-04-24 10:59:32 UTC
(rev 7476)
@@ -234,36 +234,37 @@
connection_name = connection_name.lower ()
if self._openConnections.has_key (connection_name):
- return self._openConnections [connection_name]
+ conn = self._openConnections [connection_name]
+ else:
- # Support for multiple open connections to the same database.
- # Specify as 'gnue:1', 'gnue:2', etc, to open two actual connections to
- # 'gnue', each with their own transactions, etc.
- connection_base = connection_name.split (':') [0]
+ # Support for multiple open connections to the same database.
+ # Specify as 'gnue:1', 'gnue:2', etc, to open two actual connections to
+ # 'gnue', each with their own transactions, etc.
+ connection_base = connection_name.split (':') [0]
- # This will throw a GConnections.NotFoundError if an unknown connection
- # name is specified. The calling method should catch this exception and
- # handle it properly (exit w/message)
- parameters = self.getConnectionParameters (connection_base)
+ # This will throw a GConnections.NotFoundError if an unknown connection
+ # name is specified. The calling method should catch this exception and
+ # handle it properly (exit w/message)
+ parameters = self.getConnectionParameters (connection_base)
- driver = parameters ['provider'].lower ().replace ('/', '.')
- behavior = parameters.get ('behavior','').lower ().replace ('/', '.')
- dbdriver = plugin.find (driver, 'gnue.common.datasources.drivers',
- 'Connection')
- conn = dbdriver.Connection (self, connection_name, parameters)
+ driver = parameters ['provider'].lower ().replace ('/', '.')
+ behavior = parameters.get ('behavior','').lower ().replace ('/', '.')
+ dbdriver = plugin.find (driver, 'gnue.common.datasources.drivers',
+ 'Connection')
+ conn = dbdriver.Connection (self, connection_name, parameters)
- self._openConnections [connection_name] = conn
+ self._openConnections [connection_name] = conn
- # Create the introspection instance
- # TODO: add support of the behavior parameter. Does it describe a path to
- # the introspection module or is it the name of a provider whose
- # introspector would be used?
- if hasattr (conn, 'behavior'):
- behavior = conn.behavior
- else:
- behavior = conn.defaultBehavior
+ # Create the introspection instance
+ # TODO: add support of the behavior parameter. Does it describe a path to
+ # the introspection module or is it the name of a provider whose
+ # introspector would be used?
+ if hasattr (conn, 'behavior'):
+ behavior = conn.behavior
+ else:
+ behavior = conn.defaultBehavior
- conn.introspector = behavior (conn)
+ conn.introspector = behavior (conn)
if login:
self.loginToConnection (conn)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7476 - trunk/gnue-common/src/datasources,
reinhard <=