Posts

Showing posts with the label UDF

[Level 3] Create UDF for Storing MAC Address.

Last time, I introduce about MySQL have two function call inet_aton(), inet_ntoa(). These two functions are for convert IPv4 address between char and it. By reducing the size of storing IPv4 data ( less disk I/O ), to increase the query performance. Click here for reference. After that, I write the stored procedure for this purpose. Click here for reference. Now I want to show up how to create a UDF for convert MAC address data between char and byte. If you have no idea about how to create UDF, Click here for reference. The step as the following: 1. Prepare a template source code ( for C Language ) from MySQL udf sample file called 'udf_example.c'. If you don't have the MySQL source code, you can download it from official website. ( In my server, the source code folder is /usr/src/redhat/SOURCES/mysql-5.1.44/sql/udf_example.c ). 2. Prepare the source code for convert MAC address from char to byte ( you can write it by your own or google it, there are many samp...

[Level 3] Create MySQL User Define Function in CentOS.

If you want to create user define function. You have following steps to do: 1. Compile MySQL source code with option "--with-mysqld-ldflags=--rdynamic" ex.   # ./configure --with-mysqld-ldflags=--rdynamic PS. mysql> show plugins; +------------+--------+----------------+---------+---------+ | Name       | Status | Type           | Library | License | +------------+--------+----------------+---------+---------+ | binlog     | ACTIVE | STORAGE ENGINE | NULL    | GPL     | | CSV        | ACTIVE | STORAGE ENGINE | NULL    | GPL     | | MEMORY     | ACTIVE | STORAGE ENGINE | NULL    | GPL     | | MyISAM     | ACTIVE | STORAGE ENGINE | NULL    | GPL     | | MRG_MY...