Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZEO
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
ZEO
Commits
f16ffbd0
Commit
f16ffbd0
authored
Jun 16, 2005
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed a bug in basic multi-database support. get_connection needs to
pass optional open arguments to secondary databases.
parent
8a06a98a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
2 deletions
+12
-2
src/ZODB/Connection.py
src/ZODB/Connection.py
+4
-1
src/ZODB/tests/multidb.txt
src/ZODB/tests/multidb.txt
+8
-1
No files found.
src/ZODB/Connection.py
View file @
f16ffbd0
...
@@ -300,7 +300,10 @@ class Connection(ExportImport, object):
...
@@ -300,7 +300,10 @@ class Connection(ExportImport, object):
"""Return a Connection for the named database."""
"""Return a Connection for the named database."""
connection
=
self
.
connections
.
get
(
database_name
)
connection
=
self
.
connections
.
get
(
database_name
)
if
connection
is
None
:
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
)
self
.
connections
.
update
(
new_con
.
connections
)
new_con
.
connections
=
self
.
connections
new_con
.
connections
=
self
.
connections
connection
=
new_con
connection
=
new_con
...
...
src/ZODB/tests/multidb.txt
View file @
f16ffbd0
...
@@ -94,7 +94,9 @@ Because that failed, db.databases wasn't changed:
...
@@ -94,7 +94,9 @@ Because that failed, db.databases wasn't changed:
You can (still) get a connection to a database this way:
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
>>> cn # doctest: +ELLIPSIS
<Connection at ...>
<Connection at ...>
...
@@ -111,6 +113,11 @@ thread/transaction/context ...):
...
@@ -111,6 +113,11 @@ thread/transaction/context ...):
>>> cn2 # doctest: +ELLIPSIS
>>> cn2 # doctest: +ELLIPSIS
<Connection at ...>
<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:
Now there are two connections in that collection:
>>> cn2.connections is cn.connections
>>> cn2.connections is cn.connections
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment