Hang on Eloy, the whole point of XMLDB is to hide the evil inconsistencies between what you need to do to define database tables in all the different DBs.
And, if you recall MDL-29332, you will remember that is is pretty much inevitable that will will have to tackle collations at some point.
The nub of the problem is that if you want locale-senstive sorting in MySQL, then you have to specify a case-insensitive collation. And, if you specify a _ci collation, then MySQL thinks that 'x' = 'X' which is a horrible problems for columns like idnumber, username, role.shortname, calculated question type variable names, ...
In the discussion we had (some time ago) I though we had agreed this approach:
- Define the database using a binary collation. This probably has the advantage of making joins quicker for varchar columns.
- Then, only specify locale-specific collations in ORDER BY clauses.
The advantage of this is that for a multi-lingual site like moodle.org, we can sort thing using the current language for each user, rather than having one collation hard-coded in the DB definition.
The disadvantage is that it will be a huge amount of work to covert Moodle to this new way of doing things.
And a lesser disadvantage is that for each lang pack, and for each supported DB type, we have to specify what collation to use for sorting. (presumably that has to go in langconfig.php).
Do you remember that discussion we had? Do you still agree that this is the right long-term plan? How long will it be before we can start working towards this long-term-plan?