Commit f16ffbd0 authored by Jim Fulton's avatar Jim Fulton

Fixed a bug in basic multi-database support. get_connection needs to

pass optional open arguments to secondary databases.
parent 8a06a98a
......@@ -300,7 +300,10 @@ class Connection(ExportImport, object):
"""Return a Connection for the named database."""
connection = self.connections.get(database_name)
if connection is None:
new_con = self._db.databases[database_name].open()
new_con = self._db.databases[database_name].open(
transaction_manager=self.transaction_manager,
mvcc=self._mvcc, version=self._version, synch=self._synch,
)
self.connections.update(new_con.connections)
new_con.connections = self.connections
connection = new_con
......
......@@ -94,7 +94,9 @@ Because that failed, db.databases wasn't changed:
You can (still) get a connection to a database this way:
>>> cn = db.open()
>>> import transaction
>>> tm = transaction.TransactionManager()
>>> cn = db.open(transaction_manager=tm)
>>> cn # doctest: +ELLIPSIS
<Connection at ...>
......@@ -111,6 +113,11 @@ thread/transaction/context ...):
>>> cn2 # doctest: +ELLIPSIS
<Connection at ...>
The second connection gets the same transaction manager as the first:
>>> cn2.transaction_manager is tm
True
Now there are two connections in that collection:
>>> cn2.connections is cn.connections
......
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