How to create a MySql user-defined function in a W

2019-07-31 19:17发布

问题:

I have written a script that creates a user-defined function (UDF) for the MySql database.

I need this UDF for a plugin that I am writing in WordPress.

Is there any way to add this UDF to the database from within the regular WordPress plugin installation scripts? (such as the "dbDelta" function for installing database tables).

Thanks for your help :-)

回答1:

Is there any way to add this UDF to the database from within the regular WordPress plugin installation scripts? (such as the "dbDelta" function for installing database tables).

Judging from the documentation, the dbDelta function takes arbitrary SQL. As long as whatever underlying mechanism that is being used allows UDFs to be created, then you should not have an issue simply creating it.