#986: MySQL database support
----------------------------+-----------------------------------------------
Reporter: anonymous | Owner: jonas
Type: enhancement | Status: reopened
Priority: high | Milestone: 0.10
Component: general | Version: devel
Severity: major | Resolution:
Keywords: database mysql |
----------------------------+-----------------------------------------------
Comment (by anonymous):
To solve the problem of (the Illegal mix of collations) which is related
to the ticket addition or view modifiy the model file
(trac/ticket/model.py) as follows:
replace the current code(starting from line number 251):
{{{
if when:
cursor.execute("SELECT time,author,field,oldvalue,newvalue "
"FROM ticket_change WHERE ticket=%s AND time=%s
"
"UNION "
"SELECT time,author,'attachment',null,filename
"
"FROM attachment WHERE id=%s AND time=%s "
"UNION "
"SELECT time,author,'comment',null,description
"
"FROM attachment WHERE id=%s AND time=%s "
"ORDER BY time",
(self.id, when, str(self.id), when, self.id,
when))
else:
cursor.execute("SELECT time,author,field,oldvalue,newvalue "
"FROM ticket_change WHERE ticket=%s "
"UNION "
"SELECT time,author,'attachment',null,filename
"
"FROM attachment WHERE id=%s "
"UNION "
"SELECT time,author,'comment',null,description
"
"FROM attachment WHERE id=%s "
"ORDER BY time", (self.id, str(self.id),
self.id))
}}}
with the following code:
{{{
if when:
cursor.execute("SELECT time,author,field,oldvalue,newvalue "
"FROM ticket_change WHERE ticket=%s AND time=%s
"
"UNION "
"SELECT _utf8 'time' COLLATE
utf8_general_ci,_utf8 'author' COLLATE utf8_general_ci,_utf8 'attachment'
COLLATE utf8_general_ci,_utf8 'null' COLLATE utf8_general_ci,_utf8
'filename' COLLATE utf8_general_ci "
"FROM attachment WHERE id=%s AND time=%s "
"UNION "
"SELECT _utf8 'time' COLLATE
utf8_general_ci,_utf8 'author' COLLATE utf8_general_ci,_utf8 'comment'
COLLATE utf8_general_ci,_utf8 'null' COLLATE utf8_general_ci,_utf8
'description' COLLATE utf8_general_ci "
"FROM attachment WHERE id=%s AND time=%s "
"ORDER BY time",
(self.id, when, str(self.id), when, self.id,
when))
else:
cursor.execute("SELECT time,author,field,oldvalue,newvalue "
"FROM ticket_change WHERE ticket=%s "
"UNION "
"SELECT _utf8 'time' COLLATE
utf8_general_ci,_utf8 'author' COLLATE utf8_general_ci,_utf8 'attachment'
COLLATE utf8_general_ci,_utf8 'null' COLLATE utf8_general_ci,_utf8
'filename' COLLATE utf8_general_ci "
"FROM attachment WHERE id=%s "
"UNION "
"SELECT _utf8 'time' COLLATE
utf8_general_ci,_utf8 'author' COLLATE utf8_general_ci,_utf8 'comment'
COLLATE utf8_general_ci,_utf8 'null' COLLATE utf8_general_ci,_utf8
'description' COLLATE utf8_general_ci "
"FROM attachment WHERE id=%s "
"ORDER BY time", (self.id, str(self.id),
self.id))
}}}
hope this will help (see patch # 3030)
--
Ticket URL: <http://projects.edgewall.com/trac/ticket/986>
The Trac Project <http://trac.edgewall.com/>
_______________________________________________
Trac-Tickets mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-tickets