mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-15 19:31:54 +08:00
Patch 2/4: executemany-regex improvement. It should match better and faster now. It also may be more readable.
https://sourceforge.net/p/mysql-python/patches/78/
This commit is contained in:
@ -15,13 +15,32 @@ except ImportError:
|
||||
TupleType = tuple
|
||||
UnicodeType = str
|
||||
|
||||
restr = (r"\svalues\s*"
|
||||
r"(\(((?<!\\)'[^\)]*?\)[^\)]*(?<!\\)?'"
|
||||
r"|[^\(\)]|"
|
||||
r"(?:\([^\)]*\))"
|
||||
r")+\))")
|
||||
restr = r"""
|
||||
\s
|
||||
values
|
||||
\s*
|
||||
(
|
||||
\(
|
||||
[^()']*
|
||||
(?:
|
||||
(?:
|
||||
(?:\(
|
||||
# ( - editor hightlighting helper
|
||||
[^)]*
|
||||
\))
|
||||
|
|
||||
'
|
||||
[^\\']*
|
||||
(?:\\.[^\\']*)*
|
||||
'
|
||||
)
|
||||
[^()']*
|
||||
)*
|
||||
\)
|
||||
)
|
||||
"""
|
||||
|
||||
insert_values = re.compile(restr, re.I)
|
||||
insert_values = re.compile(restr, re.S | re.I | re.X)
|
||||
|
||||
from _mysql_exceptions import Warning, Error, InterfaceError, DataError, \
|
||||
DatabaseError, OperationalError, IntegrityError, InternalError, \
|
||||
|
Reference in New Issue
Block a user