Commit 1ceb36d8 authored by Christian Theune's avatar Christian Theune

- Completed (low level) multi-database support. See testmultidb.py

parent 070a730d
...@@ -257,8 +257,13 @@ class Connection(ExportImport, object): ...@@ -257,8 +257,13 @@ class Connection(ExportImport, object):
def get_connection(self, database_name): def get_connection(self, database_name):
"""Return a Connection for the named database.""" """Return a Connection for the named database."""
# XXX implement this connection = self.connections.get(database_name)
return if connection is None:
new_con = self._db.databases[database_name].open()
self.connections.update(new_con.connections)
new_con.connections = self.connections
connection = new_con
return connection
def getTransaction(self): def getTransaction(self):
"""Get the current transaction for this connection. """Get the current transaction for this connection.
...@@ -453,6 +458,9 @@ class Connection(ExportImport, object): ...@@ -453,6 +458,9 @@ class Connection(ExportImport, object):
self._reader = ConnectionObjectReader(self, self._cache, self._reader = ConnectionObjectReader(self, self._cache,
self._db.classFactory) self._db.classFactory)
# Multi-database support
self.connections = {self._db.database_name: self}
def _resetCache(self): def _resetCache(self):
"""Creates a new cache, discarding the old one. """Creates a new cache, discarding the old one.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment