Spec-Zone .ru
спецификации, руководства, описания, API

23.3. Adding New Functions to MySQL

23.3.1. Features of the User-Defined Function Interface
23.3.2. Adding a New User-Defined Function
23.3.3. Adding a New Native Function

There are three ways to add new functions to MySQL:

Each method of creating compiled functions has advantages and disadvantages:

Whichever method you use to add new functions, they can be invoked in SQL statements just like native functions such as ABS() or SOUNDEX().

See Section 9.2.4, "Function Name Parsing and Resolution", for the rules describing how the server interprets references to different kinds of functions.

The following sections describe features of the UDF interface, provide instructions for writing UDFs, discuss security precautions that MySQL takes to prevent UDF misuse, and describe how to add native MySQL functions.

For example source code that illustrates how to write UDFs, take a look at the sql/udf_example.c file that is provided in MySQL source distributions.