Modify

Opened 15 years ago

Last modified 7 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 Ryan J Ollos)

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)

model.py (45.3 KB) - added by radu.micu@… 15 years ago.
model.py updated

Download all attachments as: .zip

Change History (4)

Changed 15 years ago by radu.micu@…

Attachment: model.py added

model.py updated

comment:1 Changed 12 years ago by Ryan J Ollos

Description: modified (diff)

comment:2 Changed 12 years ago by Ryan J Ollos

Description: modified (diff)

comment:3 Changed 7 years ago by figaro

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"

Modify Ticket

Change Properties
Set your email in Preferences
Action
as new The owner will remain Petr Škoda.

Add Comment


E-mail address and name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.