You are here
MySQL User Defined Function (UDF) collection
I really like this new toy called UDF. So I try to provide some more, hopefully useful, functionality.
A list of what I have done up to now you can find here:
- Query and change InnoDB spin_wait_delay: udf_spin_wait_delay.tgz
- Send message to the MySQL error log: udf_log_error.tgz, works also with MySQL 5.1.42
If you have some more suggestions, please let me know. If you need some special features as UDF talk to our consulting services if they can implement it.
Get and set InnoDB spin_wait_delay
mysql> CREATE FUNCTION spin_wait_delay RETURNS INTEGER SONAME "udf_spin_wait_delay-5.1.30-linux-i686-glibc23.so"; mysql> SELECT spin_wait_delay(); +--------------------+ | spin_wait_delay(5) | +--------------------+ | 5 | +--------------------+ mysql> SELECT spin_wait_delay(8); +--------------------+ | spin_wait_delay(8) | +--------------------+ | 8 | +--------------------+ mysql> DROP FUNCTION spin_wait_delay;
Send message to MySQL error log
mysql> CREATE FUNCTION log_error RETURNS INTEGER SONAME "udf_log_error-5.1.30-linux-i686-glibc23.so"; mysql> SELECT log_error('My error message...'); shell> tail -n 1 error.log 091019 20:11:07 My error message... mysql> DROP FUNCTION log_error;
tags: