O'Reilly logo

Managing & Using MySQL, 2nd Edition by Hugh E. Williams, Randy Yarger, George Reese, Tim King

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required