Modify ↓
Opened 16 years ago
Last modified 9 years ago
#5553 new enhancement
SQL Syntax from plugin will be broken if MySQL is used
| Reported by: | RaduM | Owned by: | Petr Škoda |
|---|---|---|---|
| Priority: | high | Component: | TracDownloaderPlugin |
| Severity: | major | Keywords: | |
| Cc: | Trac Release: | 0.11 |
Description (last modified by )
Hi there if you use MySQL with Trac and this plugin all the SQL syntax will be broken and needs to be changed.
For example:
cursor.execute("SELECT id, name, notes, sort, timestamp, deleted " "FROM downloader_category " "WHERE id = %s", (id,))
This will break near id = %s because you need to specify the table where ID resides. Something like this:
cursor.execute("SELECT id, name, notes, sort, timestamp, deleted " "FROM downloader_category " "WHERE downloader_category.id = %s", (id,))
I have changed all the syntax and now works ok.
Attachments (1)
Change History (4)
Changed 16 years ago by
comment:1 Changed 14 years ago by
| Description: | modified (diff) |
|---|
comment:2 Changed 14 years ago by
| Description: | modified (diff) |
|---|
comment:3 Changed 9 years ago by
Diff between both files, in absence of diff tool that outputs in unified format:
292c292
< "WHERE id = %s", (id,))
---
> "WHERE downloader_category.id = %s", (id,))
366c366
< "WHERE category=%s AND deleted IS NULL "
---
> "WHERE downloader_release.category=%s AND downloader_release.deleted IS NULL "
412c412
< "WHERE id = %s", (id,))
---
> "WHERE downloader_release.id = %s", (id,))
507c507
< "WHERE release=%s AND deleted IS NULL "
---
> "WHERE downloader_file.release=%s AND downloader_file.deleted IS NULL "
554c554
< "WHERE id = %s", (id,))
---
> "WHERE downloader_file.id = %s", (id,))
811,812c811,812
< "WHERE downloaded=%s", (self.id,))
< cursor.execute("DELETE FROM downloader_downloaded WHERE id=%s",
---
> "WHERE downloader_downloaded_attributes.downloaded=%s", (self.id,))
> cursor.execute("DELETE FROM downloader_downloaded WHERE downloader_downloaded_attributes.id=%s",
833c833
< "WHERE timestamp>=%s AND timestamp<=%s", (start, end))
---
> "WHERE downloader_downloaded.timestamp>=%s AND downloader_downloaded.timestamp<=%s", (start, end))
841c841
< "WHERE downloaded=%s", (id,))
---
> "WHERE downloader_downloaded_attributes.downloaded=%s", (id,))
844c844
< " timestamp>=%s AND timestamp<=%s", (start, end))
---
> " downloader_downloaded.timestamp>=%s AND downloader_downloaded.timestamp<=%s", (start, end))
854c854
< "WHERE id=%s", (id,))
---
> "WHERE downloader_downloaded.id=%s", (id,))
863c863
< "downloader_downloaded_attributes WHERE downloaded=%s"
---
> "downloader_downloaded_attributes WHERE downloader_downloaded_attributes.downloaded=%s"
Note: See
TracTickets for help on using
tickets.



model.py updated