Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
nexedi
erp5
Commits
95e7d36a
Commit
95e7d36a
authored
7 years ago
by
Vincent Pelletier
Browse files
Options
Download
Email Patches
Plain Diff
ZMySQLDA: Allow BEGIN xor LOCK to reconnect
Saves one round-trip to server.
parent
fe6fe6c4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
product/ZMySQLDA/db.py
product/ZMySQLDA/db.py
+2
-4
No files found.
product/ZMySQLDA/db.py
View file @
95e7d36a
...
...
@@ -403,12 +403,10 @@ class DB(TM):
"""Begin a transaction (when TM is enabled)."""
try
:
self
.
_transaction_begun
=
True
# Ping the database to reconnect if connection was closed.
self
.
_query
(
"SELECT 1"
,
allow_reconnect
=
True
)
if
self
.
_transactions
:
self
.
_query
(
"BEGIN"
)
self
.
_query
(
"BEGIN"
,
allow_reconnect
=
True
)
if
self
.
_mysql_lock
:
self
.
_query
(
"SELECT GET_LOCK('%s',0)"
%
self
.
_mysql_lock
)
self
.
_query
(
"SELECT GET_LOCK('%s',0)"
%
self
.
_mysql_lock
,
allow_reconnect
=
not
self
.
_transactions
)
except
:
LOG
(
'ZMySQLDA'
,
ERROR
,
"exception during _begin"
,
error
=
sys
.
exc_info
())
...
...
This diff is collapsed.
Click to expand it.
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