For a migration, I needed a latin1_german1_cs collation, that is, I needed German umlauts to sort as their base characters.
Here is what to do: Find your charsets directory with "SHOW VARIABLES LIKE 'char%dir%'".
Inside that directory will be a file Index.xml. Find a free id and add your new collation using an unused id. Add a description and a name.
Inside the same directory is a file latin1.xml. Inside that file, copy the block of the collation matching your new collation most closely, and adapt it as needed. In my case, I changed latin1_german1_ci to _cs, and modified the character values to match.
Patch attached after the break.
How to use:
After applying the patch, the server must be restarted. "SHOW COLLATION" will now show the new latin1_german1_cs collation. "ALTER TABLE t CHANGE COLUMN oldcol newcol varchar(80) CHARSET latin1 COLLATE latin1_german1_cs NOT NULL" will change any old column to the new collation and recreate indices as needed.
Because we changed a single byte character set, we do not need to recomple anything. Try sorting by latin1_bin, latin1_german1_ci and latin1_german1_cs to observe how things are different with each collation.
Continue reading "latin1_german1_cs"
Comments
Sun, 11.05.2008 06:34
In reply to "stuff with no nam es":very informative and succi nct. I am retired and need to learn to build a website [...]
Wed, 30.04.2008 14:08
what is the difference between MySql and PostgreSql?
Wed, 09.04.2008 21:46
What a random fortune, who kno ws what it means. My favorite random fortune cookie note rea ds "you will make a good [...]
Thu, 27.03.2008 19:17
Hi Kristian, I noticed a fe w things that are wrong with y our above article. Overall it is good however, so don [...]
Wed, 19.03.2008 15:01
Sorry, I should mention that t he create transaction simply i nvolves doing: content = Bl ogContent.new(params[:co [...]
Wed, 19.03.2008 14:51
I like to separate text and bl ob columns into their own mode ls and tables, storing and man aging the record content [...]
Wed, 27.02.2008 04:47
IMHO: Rails is being designed and primarily used by people w ith a dedicated DB. So the ide a of constraining in the [...]
Wed, 27.02.2008 04:33
Rails only uses transactions i f you ask it to. If you just d o a People.find(:all), it does a select * from people, [...]