#305 executemany() degrades when VALUES clause is upper-case

MySQLdb-1.2
closed
MySQLdb (285)
5
2012-09-19
2010-10-17
Anonymous
No

In MySQLdb 1.2.3 the regular expression used in cursors.py to match the VALUES clause is missing the case-insensitive flag, so executemany() will be slower if the word 'VALUES' is not in lower case because it degrades to executing the query once for every row when the expression cannot be matched.

Discussion

  • Rinze

    Rinze - 2011-01-20

    Another side effect is that the row count does not match the number of records inserted. It always is 1.

    Sorry I don't have a patch file, but the solution seems to be simple: Line 19 in cursors.py needs to be changed from

    insert_values = re.compile(restr)

    to

    insert_values = re.compile(restr, re.IGNORECASE)

     
  • Rinze

    Rinze - 2011-01-21

    Never mind, it seems to be fixed in the current trunk. People can still use my info to patch up the current release though.

     
  • Andy Dustman

    Andy Dustman - 2012-09-07

    Reporter reports that it's fixed

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks