Use MySQL database collation for string literals (bug #985608)
In MySQL, the collation for string literals in SQL expressions is
defined by the connection collation, which can be different from the
column collations inside the database. When comparing string literals
to values selected from the database, this can result in an "Illegal
mix of collations" error, even if both the connection and the database
use the same character set.
Mahara already requires the column and connection character sets to be
utf8, but doesn't care about the collations, so we can fix this with
the MySQL "SET CHARACTER SET" statement, which sets the connection
collation to match the database collation.
Change-Id: Ied6fcf7062fae5aa315a43ec9ce80883e6ef5b2e
Signed-off-by: Richard Mansfield <email address hidden>
Reviewed: https:/ /reviews. mahara. org/1165 gitorious. org/mahara/ mahara/ commit/ 2030d3834d6fc84 223edf0a8556773 df79d4c86a
Committed: http://
Submitter: Hugh Davenport (<email address hidden>)
Branch: 1.5_STABLE
commit 2030d3834d6fc84 223edf0a8556773 df79d4c86a
Author: Richard Mansfield <email address hidden>
Date: Fri Apr 20 13:54:30 2012 +1200
Use MySQL database collation for string literals (bug #985608)
In MySQL, the collation for string literals in SQL expressions is
defined by the connection collation, which can be different from the
column collations inside the database. When comparing string literals
to values selected from the database, this can result in an "Illegal
mix of collations" error, even if both the connection and the database
use the same character set.
Mahara already requires the column and connection character sets to be
utf8, but doesn't care about the collations, so we can fix this with
the MySQL "SET CHARACTER SET" statement, which sets the connection
collation to match the database collation.
Change-Id: Ied6fcf7062fae5 aa315a43ec9ce80 883e6ef5b2e
Signed-off-by: Richard Mansfield <email address hidden>