Sample repository to extend MySQL server by develop additional function. (MySQL UDF)
gcc -shared -o mcalc.so sample.cc -std=c++11 -fPIC
cd sql
make mcalc.o
Return Integer:
CREATE FUNCTION mcalc RETURNS int SONAME "mcalc.so";
(Not for this repo) Return Double:
CREATE FUNCTION mcalc RETURNS double SONAME "mcalc.so";
(Not for this repo) Return String:
CREATE FUNCTION mcalc RETURNS STRING SONAME "mcalc.so";
DROP FUNCTION mcalc;
It will show path where to put the .so
file:
SHOW VARIABLES LIKE 'plugin_dir';
Tested on: MariaDB 10.3.18
- https://github.com/BaseMax/MysqlCalc
- https://github.com/MariaDB/server
- https://github.com/mysql/mysql-server
My nickname is Max, Programming language developer, Full-stack programmer. I love computer scientists, researchers, and compilers.
A team includes some programmer, developer, designer, researcher(s) especially Max Base.