#322 %% not interpreted correctly in query w/o parameters

MySQLdb-1.3
open
Andy Dustman
MySQLdb (285)
5
2012-09-19
2012-04-27
Anonymous
No

Since MySQLdb uses paramstyle 'format', literal "%" has to be escaped as "%%". However, if you do a query without parameters using cursor.execute(sql), "%%" remains literal "%%". Workaround is to use cursor.execute(sql,())

Discussion

  • Andy Dustman
    Andy Dustman
    2012-09-19

    I suppose it could default the parameters to (), and I think that won't break anything, but I'll have to test it.