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:
André Malo
2012-10-03 13:15:38 -04:00
committed by farcepest
parent a7f55a5d6a
commit 1c33baf352

View File

@ -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, \