diff options
author | André Malo <ndparker@users.sf.net> | 2012-10-03 13:15:38 -0400 |
---|---|---|
committer | farcepest <farcepest@gmail.com> | 2012-10-03 13:15:38 -0400 |
commit | 1c33baf352a2e4ec7de41cfdfb38ca62b5b3ee5b (patch) | |
tree | 9071f80c827d203e5e75db5b5638e3e076098b95 /MySQLdb | |
parent | a7f55a5d6a89cc2f3b750a2b3f06c69cf6e02a5c (diff) | |
download | mysqldb1-1c33baf352a2e4ec7de41cfdfb38ca62b5b3ee5b.tar.gz |
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/
Diffstat (limited to 'MySQLdb')
-rw-r--r-- | MySQLdb/MySQLdb/cursors.py | 31 |
1 files changed, 25 insertions, 6 deletions
diff --git a/MySQLdb/MySQLdb/cursors.py b/MySQLdb/MySQLdb/cursors.py index ffe60c0..a8cfa3e 100644 --- a/MySQLdb/MySQLdb/cursors.py +++ b/MySQLdb/MySQLdb/cursors.py @@ -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, \ |