#28 Wrong regexp in executemany() function.

MySQLdb-1.0
closed
Andy Dustman
MySQLdb (285)
5
2012-09-19
2002-01-18
Anonymous
No

executemany() function don't work when your have a
table whose names ends with 'values'.

In particular, the following statement wouldn't work:

c.execute("create table avalues(a int, b int)")
c.executemany("insert into avalues(a,b) values('%s','%
s')", [(1,2),(3,4)])

assuming c is an existing cursor.

Suggestion:

change line 9 in cursors.py

from
insert_values = re.compile(r'values\s*((.+))',
re.IGNORECASE)

to
insert_values = re.compile(r'\svalues\s*((.+))',
re.IGNORECASE)

Discussion

  • Andy Dustman
    Andy Dustman
    2002-01-29

    Logged In: YES
    user_id=71372

    fixed in cvs (post 0.9.2a2)