diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-31 09:47:14 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2021-03-31 09:47:14 +0300 |
commit | 50de71b026ddb560db2be14a06897874a5732dac (patch) | |
tree | 576632c133864dca617a3e9f9855937c1ecae897 /sql/item_create.cc | |
parent | 7ae37ff74fc18c391bd0d3fd1fbf6afafe966435 (diff) | |
parent | d6d3d9ae2ffb1df8eebfe0c922394bbc7b12e4ed (diff) | |
download | mariadb-git-50de71b026ddb560db2be14a06897874a5732dac.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'sql/item_create.cc')
-rw-r--r-- | sql/item_create.cc | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/sql/item_create.cc b/sql/item_create.cc index 5f6e7b29d5c..a80781259ca 100644 --- a/sql/item_create.cc +++ b/sql/item_create.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2008, 2020, MariaDB Corporation. + Copyright (c) 2008, 2021, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -109,7 +109,6 @@ public: @return An item representing the function call */ virtual Item *create_2_arg(THD *thd, Item *arg1, Item *arg2) = 0; - protected: /** Constructor. */ Create_func_arg2() {} @@ -136,7 +135,6 @@ public: @return An item representing the function call */ virtual Item *create_3_arg(THD *thd, Item *arg1, Item *arg2, Item *arg3) = 0; - protected: /** Constructor. */ Create_func_arg3() {} @@ -908,6 +906,19 @@ class Create_func_distance : public Create_func_arg2 Create_func_distance() {} virtual ~Create_func_distance() {} }; + + +class Create_func_distance_sphere: public Create_native_func +{ + public: + Item *create_native(THD *thd, LEX_CSTRING *name, List<Item> *item_list); + static Create_func_distance_sphere s_singleton; + + protected: + Create_func_distance_sphere() {} + virtual ~Create_func_distance_sphere() {} +}; + #endif @@ -4878,6 +4889,26 @@ Create_func_glength::create_1_arg(THD *thd, Item *arg1) { return new (thd->mem_root) Item_func_glength(thd, arg1); } + + +Create_func_distance_sphere Create_func_distance_sphere::s_singleton; + +Item* +Create_func_distance_sphere::create_native(THD *thd, LEX_CSTRING *name, + List<Item> *item_list) +{ + int arg_count= 0; + + if (item_list != NULL) + arg_count= item_list->elements; + + if (arg_count < 2) + { + my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0), name->str); + return NULL; + } + return new (thd->mem_root) Item_func_sphere_distance(thd, *item_list); +} #endif @@ -7457,6 +7488,7 @@ static Native_func_registry func_array[] = { { STRING_WITH_LEN("ST_WITHIN") }, GEOM_BUILDER(Create_func_within)}, { { STRING_WITH_LEN("ST_X") }, GEOM_BUILDER(Create_func_x)}, { { STRING_WITH_LEN("ST_Y") }, GEOM_BUILDER(Create_func_y)}, + { { C_STRING_WITH_LEN("ST_DISTANCE_SPHERE") }, GEOM_BUILDER(Create_func_distance_sphere)}, { { STRING_WITH_LEN("SUBSTR_ORACLE") }, BUILDER(Create_func_substr_oracle)}, { { STRING_WITH_LEN("SUBSTRING_INDEX") }, BUILDER(Create_func_substr_index)}, |