问题
I just transferred my database to Google's Cloud SQL, but as stated in the FAQ on Google Cloud SQL, it says user defined functions are not supported. I am using a function called Levenshtein, taken from this stackoverflow article, to perform a search on a dictionary that I created in my database. It is a function that can find words that look similar (including misspellings) and returns the distance from a given word.
Does Google offer any alternatives to user defined functions that would allow me to use this functionality to perform search?
回答1:
You are confused about terminology:
User Defined Function = A function defined in real code, compiled into a DLL/SO, and created in MySQL with CREATE FUNCTION ... SONAME. This is not possible in Cloud SQL.
Stored Procedure = A function defined in SQL statements, and created in MySQL with CREATE FUNCTION routine_body or
CREATE PROCEDURE
. This is allowed in Cloud SQL.
I just tested this out by copying and pasting the definition from that SO post into my Cloud SQL instance and it worked perfectly.
来源:https://stackoverflow.com/questions/29715273/alternative-to-user-defined-functions-in-googles-cloud-sql