|MicroCheapFx 4e436745ef Merging origin/master||2 years ago|
|include||2 years ago|
|src||2 years ago|
|test||2 years ago|
|.gitignore||2 years ago|
|.gitignore.orig||2 years ago|
|CMakeLists.txt||2 years ago|
|README.md||2 years ago|
|hello.so||2 years ago|
|setup.sh||2 years ago|
This is a simple demo to show maridb UDF mechanisms.
In order to follow this tutorial, you’ll need the following tools:
This UDF doesn’t do a real killer feature. It just return a “Hello” message to mariadb. But it is simple enough to understand how it works.
MariaDB [(none)]> SELECT hello('John Doe'); +-------------------+ | hello('John Doe') | +-------------------+ | Hello John Doe! | +-------------------+ 1 row in set (0.00 sec)
User Defined Functions are stored in dynamical shared libraries (.so files) and are sets of functions adding new possibilities to mariadb engine.
With them, you’ll be able to process data with C execution fuzzing speed or even be able to communicate with the rest of your operating system.
What is essential to understand is that they are external to mariadb. So in order to communicate with the engine, they need to communicate in a standard way with a predefined set of variables and functions.
Also, as they are only shared libraries, you won’t be able to debug them within mariadb. In order to fix that, we’ll write a little program in C, mocking mariadb engine. This program will also be a good unit testing set.