SQL statements not MSSQL compliant
|Reported by:||Björn Swift||Owned by:||Noah Kantrowitz|
The WikiRenamePlugin has some hard coded SQL statements which are not MSSQL compliant. I made two changes to util.py, which seems to make things right. I haven't tested this against sqlite (or mysql/postgres), but I assume this works for those as well.
The first change was made since MSSQL's column names are case sensitive when the database's collation is binary sort:
17c17 < '(SELECT name, MAX(version) AS VERSION FROM WIKI GROUP BY NAME) w2 ' + \ --- > '(SELECT name, MAX(version) AS version FROM wiki GROUP BY name) w2 ' + \
The second change was made since assignment strings need to be single quoted in MSSQL, but not double quoted.
41c41 < cursor.execute('UPDATE attachment SET id=%s WHERE type="wiki" AND id=%s', (newname,oldname)) --- > cursor.execute('UPDATE attachment SET id=%s WHERE type=\'wiki\' AND id=%s', (newname,oldname))
Hope this get submitted.