Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#12269 closed defect (fixed)

Error occurs when used with MySQL

Reported by: theYT <dev@…> Owned by: theYT <dev@…>
Priority: high Component: WikiTableMacro
Severity: critical Keywords: SQLTable MySQL
Cc: Trac Release: 1.0


I am using Trac (version 1.1.5dev) and SQLTable Macro (latest version [14524]) with MySQL Database. When I use macro, 'long' object has no attribute 'fetchall' Error occurs.

It seems to be due to cursor.execute function used in the file / function expand_macro:

  • sqlite3.cursor.execute returns cursor
  • MySQLdb.cursor.execute returns a number of rows

( page notes "Return values are not defined.")

Simple patch below have fixed the issue.

  • wikitable/

    5858        try:
    5959            with self.env.db_query as db:
    6060                cursor = db.cursor()
    61                 rows = cursor.execute(content).fetchall()
     61                cursor.execute(content)
     62                rows = cursor.fetchall()
    6263                cols = get_column_names(cursor)
    6364        except self.env.db_exc.DatabaseError, e:
    6465            return system_message(_("Invalid SQL"), exception_to_unicode(e))

Attachments (0)

Change History (3)

comment:1 Changed 9 years ago by Ryan J Ollos

Thank you for the patch. I've seen the issue before so I should have known better. I'll commit the change today.

comment:2 Changed 9 years ago by Ryan J Ollos

Resolution: fixed
Status: newclosed

In 14531:

0.3dev: Fix issue fetching from cursor on MySQL.

Patch by theYT <dev@…>. Fixes #12269.

comment:3 Changed 9 years ago by Ryan J Ollos

Owner: changed from Ryan J Ollos to theYT <dev@…>

Modify Ticket

Change Properties
Set your email in Preferences
as closed The owner will remain theYT <dev@…>.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment

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

Note: See TracTickets for help on using tickets.