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_charsetto_upper_charsetto_lower_charsetsort_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_charsetmy_strnxfrm_charsetmy_strcoll_charsetmy_strxfrm_charsetmy_like_range_charset
We therefore need to create my_strnncoll_elvish,
my_strnxfrm_elvish ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access