Code Generators for MySQL Plugins and User Defined Functions (UDFs)

The MySQL server currently provides two different APIs
that allow to extend its functionality dynamicly at
runtime: User Defined Functions (UDFs) since MySQL 3.23
and Plugins starting with MySQL 5.1.

Both APIs require require quite a bit of knowledge
to get started with, e.g. required include files,
compiler and linker options, the actual API,
required helper functions …

The code generator approach tries to shield you
from these infrastructural details as much as
possible so that you can start to implement and
test the actual plugin functionality almost
immediately.

There are actually two different code generators
named CodeGen_MySQL_UDF and CodeGen_MySQL_Plugin
that generate project code for the two different
APIs.

The generator input files consist of a mix of
XML tags for the plugin specification and embedded
code snippets for the actual functionality.

A very minimalistic UDF extension specification file
looks like this for example:

<?xml version=“1.0”?> <!-- a simple function returning twice its input value --> return val * 2;

and a working UDF extension can be created from
it with just the four simple commands:

udf-gen minimal.xml cd minimal configure —with-mysql=/path/to/your/mysql/installation make

Both code generators are derived from the same
code generator framework packages (that is also used by
the pecl-gen code generator for PHP extensions).

Currently the two generators cover the following
types of pluggable extensions:

- User Defined Functions
- Daemon Plugins
- Fulltext Parser Plugins
- Information Schema Table Plugins
- Storage Engine Plugins (work in Progress)

The code generators take care of

- autotool input files to generate proper
“configure” and “Makefile” files

- ready-to-compile code and header files

- integration of additional source files,
including e.g. flex and bison parser sources

- a mysqltest based test framework

- docbook based documentation skeletons

- windows build support (work in progress)

- …

Preliminary information on both code generators is available here:

  • http://codegenerators.php-baustelle.de/trac/wiki/CodeGen_MySQL_Plugin
  • http://codegenerators.php-baustelle.de/trac/wiki/CodeGen_MySQL_UDF

Some examples of MySQL UDFs created with this tools:
http://udf-ora.php-baustelle.de/
http://udf-regexp.php-baustelle.de/

Hartmut Holzgraefe

MySQL

Hartmut studied electric engineering and computer sciense with biology as a sub topic in Germany. He has been part of the PHP development and documentation team since late 1999.

He joined the MySQL support team in 2004 and is now a principal support engineer with a focus on MySQL Cluster.

Sponsors
  • Kickfire
  • Zmanda, Inc.
  • Continuent
  • EDS
  • JasperSoft
  • Sun Microsystems
  • Symantec Anti-Virus Software
  • XAware
  • Data Direct Technologies
  • Dolphin Interconnect Solutions
  • Hewlett Packard
  • Infobright, Inc
  • Linagora
  • Microsoft
  • OpSource
  • Oracle
  • Pentaho
  • R1Soft
  • Red Hat
  • Ticketmaster
  • TechRepublic

Contact Us

View a complete list of MySQL contacts.