1

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 Answer 1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your quick answer. After thinking a bit about this issue, I found the solution: 1. Use $wpdb->query('place the create function code here'); 2. Don't use the delimiter command in your sql command (such as 'delimiter //') - just use the default semi-colon (';') delimiter.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.