mirror of
https://github.com/PyMySQL/mysqlclient.git
synced 2025-08-16 03:50:43 +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
|
TupleType = tuple
|
||||||
UnicodeType = str
|
UnicodeType = str
|
||||||
|
|
||||||
restr = (r"\svalues\s*"
|
restr = r"""
|
||||||
r"(\(((?<!\\)'[^\)]*?\)[^\)]*(?<!\\)?'"
|
\s
|
||||||
r"|[^\(\)]|"
|
values
|
||||||
r"(?:\([^\)]*\))"
|
\s*
|
||||||
r")+\))")
|
(
|
||||||
|
\(
|
||||||
|
[^()']*
|
||||||
|
(?:
|
||||||
|
(?:
|
||||||
|
(?:\(
|
||||||
|
# ( - 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, \
|
from _mysql_exceptions import Warning, Error, InterfaceError, DataError, \
|
||||||
DatabaseError, OperationalError, IntegrityError, InternalError, \
|
DatabaseError, OperationalError, IntegrityError, InternalError, \
|
||||||
|
Reference in New Issue
Block a user