Data type plugins should be able to provide their own sets of built-in functions.
Let's add a new class Function_collection, as follows:
and, as a prove of the conceipt, move all GIS functions into a new class Function_collection_geometry.
- The method init() will do the collection initialization, e.g. create a hash to lookup Create_func builders by function names.
- The method cleanup will free all memory allocated by init(), e.g. free the lookup hash.
- The method find_native_function_builder will lookup a function by name and return its Create_func builder (or NULL if the function is not found).
This task will also do the following:
- Move all GIS function Create_func_xxx classes from item_create_cc to item_geofunc.cc
- Move definitions of Create_func_arg0, Create_func_arg1, Create_func_arg2, Create_func_arg3 from item_create.cc to item_create.h, so function collection plugins can reuse these classes.
- Remove this code from the bison grammar:
and add something like this into the function_call_generic rule:
- Add a global instance of Function_collection_geometry
Later, in a separate MDEV, we'll add a new plugin type, MYSQL_FUNCTION_COLLECTION_PLUGIN.