Complex Character Sets
Character sets requiring special string collating routines for sorting or multi-byte character support will need custom work a configuration file simply cannot handle. To accomplish this task, you will need to be familiar with C programming, as you will need to create several C source files. If you plan to attempt this, it is highly recommended that you study the existing ctype-*.c files and base yours on these.
As with simple character sets, you need to edit the sql/share/charsets/Index and configure.in files. Instead of a configuration file, however, you need to create a C source file called ctype -charset.c. In our case, this file will be ctype-elvish.c. You can get a head start with your character set file by copying the source file for a similar character set.
The first task in this source file is to define
ctype
,
to_lower
,
to_upper
, and
sort_order
. These are the same arrays you
configured in the previous section, except they are defined as C
arrays. You’ll need to create:
ctype_
charset
to_upper_
charset
to_lower_
charset
sort_order_
charset
For our example, we need to create ctype_elvish
,
to_upper_elvish
,
to_lower_elvish
, and
sort_order_elvish
.
If you need string collating functions, you must write your own custom string collating functions. These functions should be named:
my_strnncoll_
charset
my_strnxfrm_
charset
my_strcoll_
charset
my_strxfrm_
charset
my_like_range_
charset
We therefore need to create my_strnncoll_elvish
,
my_strnxfrm_elvish ...
Get Managing & Using MySQL, 2nd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.