Tuesday, March 18, 2008

Creative MySQL hacking and Summer of Code


You can hack the MySQL server in three ways:
  • Changing the server code. This is straightforward. Download the code, and make the changes you need. If you need the change only for a limited period, this is enough. If the change must be persistent, then you should try to make it accepted. The Code Contribution Program may be for you.
  • Creating a plugin or a UDF. Using the plugin interface or the UDF API you can extend the server in many ways. UDFs require that you (and the user) be able to compile the additional code. Plugins require compiling code only from the author.
  • Mixing the existing hooks. This means being creative bu stretching the intended purpose of simple components of the server or external tools. This is how you can hack the server and create new features using stored routines, events, engines like federated, blackhole, archive, and external tools like MySQL Proxy. This is like composing chess puzzles, where you are given the basic rules, and you have to achieve clever results. This sort of jigsaw puzzle hacking is my favorite.

I am considering some of this latest hacking ideas for the incoming Summer of Code.
If you have any ideas on this department and you would like to pursue them, please send a message to the SoC mailing list. I will be glad to discuss them.

1 comment:

rpbouman said...

Hi!

You forgot one of the most charming extension points: custom collations!!

Using a custom collation you can for example create a "phone" collation - one that sorts all interpunction as a single weight.

For example

+12819130892

and

+1 281 913 0892

and

12819130892

are all the same with this collation.

The advantage over stripping out those extra characters is that you can store the value as is, but enforce unicity without taking the non-digits into account.

And all of this is possible by just hacking a little xml file beneath your server dir...no recompilation, triggers, nada.