diff options
author | Alexander Barkov <bar@mariadb.com> | 2019-10-16 12:43:24 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.com> | 2019-10-16 21:40:30 +0400 |
commit | 5a052ab6b11aadcf62bb3a7efb2acbe14355e0b1 (patch) | |
tree | 571f4afce97785b8fffde8adaeb5b0ef82b3fc9d /sql | |
parent | 22b645ef5292387871b12b26fd550eed6e57aa2d (diff) | |
download | mariadb-git-5a052ab6b11aadcf62bb3a7efb2acbe14355e0b1.tar.gz |
Part1: MDEV-20837 Add MariaDB_FUNCTION_PLUGIN
- Defining MariaDB_FUNCTION_PLUGIN
- Changing the code in /plugins/type_inet/ and /plugins/type_test/
to use MariaDB_FUNCTION_PLUGIN instead of MariaDB_FUNCTION_COLLECTION_PLUGIN.
- Changing maturity for the INET6 data type plugin from experimental to alpha.
Diffstat (limited to 'sql')
-rw-r--r-- | sql/item_create.cc | 22 | ||||
-rw-r--r-- | sql/sql_plugin.cc | 7 |
2 files changed, 29 insertions, 0 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index e8eb76dfc12..246850d9548 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -35,6 +35,7 @@ #include "sp.h" #include "sql_time.h" #include "sql_type_geom.h" +#include <mysql/plugin_function.h> #include <mysql/plugin_function_collection.h> @@ -5710,6 +5711,24 @@ void item_create_cleanup() DBUG_VOID_RETURN; } + +static Create_func * +function_plugin_find_native_function_builder(THD *thd, const LEX_CSTRING &name) +{ + plugin_ref plugin; + if ((plugin= my_plugin_lock_by_name(thd, &name, MariaDB_FUNCTION_PLUGIN))) + { + Create_func *builder= + reinterpret_cast<Plugin_function*>(plugin_decl(plugin)->info)-> + create_func(); + // TODO: MDEV-20846 Add proper unlocking for MariaDB_FUNCTION_PLUGIN + plugin_unlock(thd, plugin); + return builder; + } + return NULL; +} + + Create_func * find_native_function_builder(THD *thd, const LEX_CSTRING *name) { @@ -5724,6 +5743,9 @@ find_native_function_builder(THD *thd, const LEX_CSTRING *name) if (func && (builder= func->builder)) return builder; + if ((builder= function_plugin_find_native_function_builder(thd, *name))) + return builder; + if ((builder= Plugin_find_native_func_builder_param(*name).find(thd))) return builder; diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index b108dfcd11f..2beb9fa0267 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -39,6 +39,7 @@ #include <mysql/plugin_password_validation.h> #include <mysql/plugin_encryption.h> #include <mysql/plugin_data_type.h> +#include <mysql/plugin_function.h> #include <mysql/plugin_function_collection.h> #include "sql_plugin_compat.h" @@ -94,6 +95,7 @@ const LEX_CSTRING plugin_type_names[MYSQL_MAX_PLUGIN_TYPE_NUM]= { STRING_WITH_LEN("PASSWORD VALIDATION") }, { STRING_WITH_LEN("ENCRYPTION") }, { STRING_WITH_LEN("DATA TYPE") }, + { STRING_WITH_LEN("FUNCTION") }, { STRING_WITH_LEN("FUNCTION COLLECTION") } }; @@ -115,6 +117,7 @@ plugin_type_init plugin_type_initialize[MYSQL_MAX_PLUGIN_TYPE_NUM]= { 0, ha_initialize_handlerton, 0, 0,initialize_schema_table, initialize_audit_plugin, 0, 0, 0, initialize_encryption_plugin, 0, + 0, // FUNCTION Plugin_function_collection::init_plugin }; @@ -122,6 +125,7 @@ plugin_type_init plugin_type_deinitialize[MYSQL_MAX_PLUGIN_TYPE_NUM]= { 0, ha_finalize_handlerton, 0, 0, finalize_schema_table, finalize_audit_plugin, 0, 0, 0, finalize_encryption_plugin, 0, + 0, // FUNCTION Plugin_function_collection::deinit_plugin }; @@ -135,6 +139,7 @@ static int plugin_type_initialization_order[MYSQL_MAX_PLUGIN_TYPE_NUM]= MYSQL_DAEMON_PLUGIN, MariaDB_ENCRYPTION_PLUGIN, MariaDB_DATA_TYPE_PLUGIN, + MariaDB_FUNCTION_PLUGIN, MariaDB_FUNCTION_COLLECTION_PLUGIN, MYSQL_STORAGE_ENGINE_PLUGIN, MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -179,6 +184,7 @@ static int min_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]= MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION, MariaDB_ENCRYPTION_INTERFACE_VERSION, MariaDB_DATA_TYPE_INTERFACE_VERSION, + MariaDB_FUNCTION_INTERFACE_VERSION, MariaDB_FUNCTION_COLLECTION_INTERFACE_VERSION }; static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]= @@ -194,6 +200,7 @@ static int cur_plugin_info_interface_version[MYSQL_MAX_PLUGIN_TYPE_NUM]= MariaDB_PASSWORD_VALIDATION_INTERFACE_VERSION, MariaDB_ENCRYPTION_INTERFACE_VERSION, MariaDB_DATA_TYPE_INTERFACE_VERSION, + MariaDB_FUNCTION_INTERFACE_VERSION, MariaDB_FUNCTION_COLLECTION_INTERFACE_VERSION }; |