diff MySQLdb/cursors.py @ 65:7a60c4574baf MySQLdb

figleaf revealed that the INSERT_VALUES regex never matched. Added a test for this, and fixed the regex (forgot to add group anchors)
author adustman
date Sun, 29 Mar 2009 00:52:14 +0000
parents 2d6a35051f64
children 5a7c30cd9de2
line wrap: on
line diff
--- a/MySQLdb/cursors.py	Sat Mar 28 13:37:58 2009 +0000
+++ b/MySQLdb/cursors.py	Sun Mar 29 00:52:14 2009 +0000
@@ -14,11 +14,9 @@
 import sys
 import weakref
 
-INSERT_VALUES = re.compile(r"\svalues\s*"
-                           r"(\(((?<!\\)'[^\)]*?\)[^\)]*(?<!\\)?'"
-                           r"|[^\(\)]|"
-                           r"(?:\([^\)]*\))"
-                           r")+\))")
+INSERT_VALUES = re.compile(r"(?P<start>.+values\s*)"
+                           r"(?P<values>\(((?<!\\)'[^\)]*?\)[^\)]*(?<!\\)?'|[^\(\)]|(?:\([^\)]*\)))+\))"
+                           r"(?P<end>.*)", re.I)
 
 
 class Cursor(object):