Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
140
Merge Requests
140
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
ac7f47d7
Commit
ac7f47d7
authored
Nov 15, 2023
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ZMySQLDA: support isolation_level argument in ZMySQLDA.db.query().
parent
ce2a342d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
4 deletions
+6
-4
product/ZMySQLDA/db.py
product/ZMySQLDA/db.py
+6
-4
No files found.
product/ZMySQLDA/db.py
View file @
ac7f47d7
...
@@ -438,7 +438,7 @@ class DB(TM):
...
@@ -438,7 +438,7 @@ class DB(TM):
else
:
else
:
raise
raise
def
query
(
self
,
query_string
,
max_rows
=
1000
):
def
query
(
self
,
query_string
,
max_rows
=
1000
,
isolation_level
=
''
):
"""Execute 'query_string' and return at most 'max_rows'."""
"""Execute 'query_string' and return at most 'max_rows'."""
desc
=
None
desc
=
None
if
isinstance
(
query_string
,
six
.
text_type
):
if
isinstance
(
query_string
,
six
.
text_type
):
...
@@ -448,8 +448,10 @@ class DB(TM):
...
@@ -448,8 +448,10 @@ class DB(TM):
# Unfortunately, MySQLdb does not want to be graceful.
# Unfortunately, MySQLdb does not want to be graceful.
if
query_string
[
-
1
:]
==
b';'
:
if
query_string
[
-
1
:]
==
b';'
:
query_string
=
query_string
[:
-
1
]
query_string
=
query_string
[:
-
1
]
if
self
.
_use_TM
and
not
self
.
_registered
:
if
self
.
_use_TM
and
not
self
.
_registered
and
isolation_level
is
not
None
:
if
self
.
_isolation_level
:
if
isolation_level
:
self
.
_current_isolation_level
=
isolation_level
elif
self
.
_isolation_level
:
self
.
_current_isolation_level
=
self
.
_isolation_level
self
.
_current_isolation_level
=
self
.
_isolation_level
else
:
else
:
for
qs
in
query_string
.
split
(
b'
\
0
'
):
for
qs
in
query_string
.
split
(
b'
\
0
'
):
...
@@ -679,7 +681,7 @@ class DeferredDB(DB):
...
@@ -679,7 +681,7 @@ class DeferredDB(DB):
assert self._use_TM
assert self._use_TM
self._sql_string_list = []
self._sql_string_list = []
def query(self, query_string, max_rows=1000):
def query(self, query_string, max_rows=1000
, isolation_level=''
):
self._register()
self._register()
if isinstance(query_string, six.text_type):
if isinstance(query_string, six.text_type):
query_string = query_string.encode('utf-8')
query_string = query_string.encode('utf-8')
...
...
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