delimiter // CREATE PROCEDURE install_jsonudfs () SQL SECURITY INVOKER READS SQL DATA BEGIN DECLARE os CHAR(3); SELECT LOWER(LEFT(VARIABLE_VALUE, 30)) AS os FROM information_schema.global_variables where VARIABLE_NAME='version_compile_os' INTO os; IF os = 'win' THEN CREATE FUNCTION json_valid RETURNS integer SONAME 'my_json_udf.dll'; CREATE FUNCTION json_search RETURNS string SONAME 'my_json_udf.dll'; CREATE FUNCTION json_extract RETURNS string SONAME 'my_json_udf.dll'; CREATE FUNCTION json_replace RETURNS string SONAME 'my_json_udf.dll'; CREATE FUNCTION json_append RETURNS string SONAME 'my_json_udf.dll'; CREATE FUNCTION json_remove RETURNS string SONAME 'my_json_udf.dll'; CREATE FUNCTION json_set RETURNS string SONAME 'my_json_udf.dll'; CREATE FUNCTION json_merge RETURNS string SONAME 'my_json_udf.dll'; CREATE FUNCTION json_contains_key RETURNS integer SONAME 'my_json_udf.dll'; ELSE CREATE FUNCTION json_valid RETURNS integer SONAME 'libmy_json_udf.so'; CREATE FUNCTION json_search RETURNS string SONAME 'libmy_json_udf.so'; CREATE FUNCTION json_extract RETURNS string SONAME 'libmy_json_udf.so'; CREATE FUNCTION json_replace RETURNS string SONAME 'libmy_json_udf.so'; CREATE FUNCTION json_append RETURNS string SONAME 'libmy_json_udf.so'; CREATE FUNCTION json_remove RETURNS string SONAME 'libmy_json_udf.so'; CREATE FUNCTION json_set RETURNS string SONAME 'libmy_json_udf.so'; CREATE FUNCTION json_merge RETURNS string SONAME 'libmy_json_udf.so'; CREATE FUNCTION json_contains_key RETURNS integer SONAME 'libmy_json_udf.so'; END IF; END// delimiter ; CALL install_jsonudfs;