これを実現するには、CまたはC++でネイティブ共有ライブラリを作成する必要があるようです。 https://dev.mysql.com/doc/refman/5.6/en/create-function-udf.html