summaryrefslogtreecommitdiff
path: root/sql/item_create.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.com>2019-10-16 12:43:24 +0400
committerAlexander Barkov <bar@mariadb.com>2019-10-16 21:40:30 +0400
commit5a052ab6b11aadcf62bb3a7efb2acbe14355e0b1 (patch)
tree571f4afce97785b8fffde8adaeb5b0ef82b3fc9d /sql/item_create.cc
parent22b645ef5292387871b12b26fd550eed6e57aa2d (diff)
downloadmariadb-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/item_create.cc')
-rw-r--r--sql/item_create.cc22
1 files changed, 22 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;