/release/src/router/mysql/sql/item_create.cc
https://gitlab.com/envieidoc/tomato · C++ · 2539 lines · 1710 code · 689 blank · 140 comment · 37 complexity · 04865e6b3384cd368e59c8788fa6b41c MD5 · raw file
- /*
- Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
- 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
- the Free Software Foundation; version 2 of the License.
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
- /**
- @file
- @brief
- Functions to create an item. Used by sql_yac.yy
- */
- #include "mysql_priv.h"
- #include "item_create.h"
- #include "sp_head.h"
- #include "sp.h"
- /*
- =============================================================================
- LOCAL DECLARATIONS
- =============================================================================
- */
- /**
- Adapter for native functions with a variable number of arguments.
- The main use of this class is to discard the following calls:
- <code>foo(expr1 AS name1, expr2 AS name2, ...)</code>
- which are syntactically correct (the syntax can refer to a UDF),
- but semantically invalid for native functions.
- */
- class Create_native_func : public Create_func
- {
- public:
- virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
- /**
- Builder method, with no arguments.
- @param thd The current thread
- @param name The native function name
- @param item_list The function parameters, none of which are named
- @return An item representing the function call
- */
- virtual Item *create_native(THD *thd, LEX_STRING name,
- List<Item> *item_list) = 0;
- protected:
- /** Constructor. */
- Create_native_func() {}
- /** Destructor. */
- virtual ~Create_native_func() {}
- };
- /**
- Adapter for functions that takes exactly zero arguments.
- */
- class Create_func_arg0 : public Create_func
- {
- public:
- virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
- /**
- Builder method, with no arguments.
- @param thd The current thread
- @return An item representing the function call
- */
- virtual Item *create(THD *thd) = 0;
- protected:
- /** Constructor. */
- Create_func_arg0() {}
- /** Destructor. */
- virtual ~Create_func_arg0() {}
- };
- /**
- Adapter for functions that takes exactly one argument.
- */
- class Create_func_arg1 : public Create_func
- {
- public:
- virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
- /**
- Builder method, with one argument.
- @param thd The current thread
- @param arg1 The first argument of the function
- @return An item representing the function call
- */
- virtual Item *create(THD *thd, Item *arg1) = 0;
- protected:
- /** Constructor. */
- Create_func_arg1() {}
- /** Destructor. */
- virtual ~Create_func_arg1() {}
- };
- /**
- Adapter for functions that takes exactly two arguments.
- */
- class Create_func_arg2 : public Create_func
- {
- public:
- virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
- /**
- Builder method, with two arguments.
- @param thd The current thread
- @param arg1 The first argument of the function
- @param arg2 The second argument of the function
- @return An item representing the function call
- */
- virtual Item *create(THD *thd, Item *arg1, Item *arg2) = 0;
- protected:
- /** Constructor. */
- Create_func_arg2() {}
- /** Destructor. */
- virtual ~Create_func_arg2() {}
- };
- /**
- Adapter for functions that takes exactly three arguments.
- */
- class Create_func_arg3 : public Create_func
- {
- public:
- virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
- /**
- Builder method, with three arguments.
- @param thd The current thread
- @param arg1 The first argument of the function
- @param arg2 The second argument of the function
- @param arg3 The third argument of the function
- @return An item representing the function call
- */
- virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3) = 0;
- protected:
- /** Constructor. */
- Create_func_arg3() {}
- /** Destructor. */
- virtual ~Create_func_arg3() {}
- };
- /**
- Function builder for Stored Functions.
- */
- class Create_sp_func : public Create_qfunc
- {
- public:
- virtual Item *create(THD *thd, LEX_STRING db, LEX_STRING name,
- bool use_explicit_name, List<Item> *item_list);
- static Create_sp_func s_singleton;
- protected:
- /** Constructor. */
- Create_sp_func() {}
- /** Destructor. */
- virtual ~Create_sp_func() {}
- };
- #ifndef HAVE_SPATIAL
- /**
- Common (non) builder for geometry functions.
- This builder is used in <code>--without-geometry</code> builds only,
- to report an error.
- */
- class Create_func_no_geom : public Create_func
- {
- public:
- virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list);
- /** Singleton. */
- static Create_func_no_geom s_singleton;
- protected:
- /** Constructor. */
- Create_func_no_geom() {}
- /** Destructor. */
- virtual ~Create_func_no_geom() {}
- };
- #endif
- /*
- Concrete functions builders (native functions).
- Please keep this list sorted in alphabetical order,
- it helps to compare code between versions, and helps with merges conflicts.
- */
- class Create_func_abs : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_abs s_singleton;
- protected:
- Create_func_abs() {}
- virtual ~Create_func_abs() {}
- };
- class Create_func_acos : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_acos s_singleton;
- protected:
- Create_func_acos() {}
- virtual ~Create_func_acos() {}
- };
- class Create_func_addtime : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_addtime s_singleton;
- protected:
- Create_func_addtime() {}
- virtual ~Create_func_addtime() {}
- };
- class Create_func_aes_encrypt : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_aes_encrypt s_singleton;
- protected:
- Create_func_aes_encrypt() {}
- virtual ~Create_func_aes_encrypt() {}
- };
- class Create_func_aes_decrypt : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_aes_decrypt s_singleton;
- protected:
- Create_func_aes_decrypt() {}
- virtual ~Create_func_aes_decrypt() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_area : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_area s_singleton;
- protected:
- Create_func_area() {}
- virtual ~Create_func_area() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_as_wkb : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_as_wkb s_singleton;
- protected:
- Create_func_as_wkb() {}
- virtual ~Create_func_as_wkb() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_as_wkt : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_as_wkt s_singleton;
- protected:
- Create_func_as_wkt() {}
- virtual ~Create_func_as_wkt() {}
- };
- #endif
- class Create_func_asin : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_asin s_singleton;
- protected:
- Create_func_asin() {}
- virtual ~Create_func_asin() {}
- };
- class Create_func_atan : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_atan s_singleton;
- protected:
- Create_func_atan() {}
- virtual ~Create_func_atan() {}
- };
- class Create_func_benchmark : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_benchmark s_singleton;
- protected:
- Create_func_benchmark() {}
- virtual ~Create_func_benchmark() {}
- };
- class Create_func_bin : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_bin s_singleton;
- protected:
- Create_func_bin() {}
- virtual ~Create_func_bin() {}
- };
- class Create_func_bit_count : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_bit_count s_singleton;
- protected:
- Create_func_bit_count() {}
- virtual ~Create_func_bit_count() {}
- };
- class Create_func_bit_length : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_bit_length s_singleton;
- protected:
- Create_func_bit_length() {}
- virtual ~Create_func_bit_length() {}
- };
- class Create_func_ceiling : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_ceiling s_singleton;
- protected:
- Create_func_ceiling() {}
- virtual ~Create_func_ceiling() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_centroid : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_centroid s_singleton;
- protected:
- Create_func_centroid() {}
- virtual ~Create_func_centroid() {}
- };
- #endif
- class Create_func_char_length : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_char_length s_singleton;
- protected:
- Create_func_char_length() {}
- virtual ~Create_func_char_length() {}
- };
- class Create_func_coercibility : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_coercibility s_singleton;
- protected:
- Create_func_coercibility() {}
- virtual ~Create_func_coercibility() {}
- };
- class Create_func_compress : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_compress s_singleton;
- protected:
- Create_func_compress() {}
- virtual ~Create_func_compress() {}
- };
- class Create_func_concat : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_concat s_singleton;
- protected:
- Create_func_concat() {}
- virtual ~Create_func_concat() {}
- };
- class Create_func_concat_ws : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_concat_ws s_singleton;
- protected:
- Create_func_concat_ws() {}
- virtual ~Create_func_concat_ws() {}
- };
- class Create_func_connection_id : public Create_func_arg0
- {
- public:
- virtual Item *create(THD *thd);
- static Create_func_connection_id s_singleton;
- protected:
- Create_func_connection_id() {}
- virtual ~Create_func_connection_id() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_contains : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_contains s_singleton;
- protected:
- Create_func_contains() {}
- virtual ~Create_func_contains() {}
- };
- #endif
- class Create_func_conv : public Create_func_arg3
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
- static Create_func_conv s_singleton;
- protected:
- Create_func_conv() {}
- virtual ~Create_func_conv() {}
- };
- class Create_func_convert_tz : public Create_func_arg3
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
- static Create_func_convert_tz s_singleton;
- protected:
- Create_func_convert_tz() {}
- virtual ~Create_func_convert_tz() {}
- };
- class Create_func_cos : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_cos s_singleton;
- protected:
- Create_func_cos() {}
- virtual ~Create_func_cos() {}
- };
- class Create_func_cot : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_cot s_singleton;
- protected:
- Create_func_cot() {}
- virtual ~Create_func_cot() {}
- };
- class Create_func_crc32 : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_crc32 s_singleton;
- protected:
- Create_func_crc32() {}
- virtual ~Create_func_crc32() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_crosses : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_crosses s_singleton;
- protected:
- Create_func_crosses() {}
- virtual ~Create_func_crosses() {}
- };
- #endif
- class Create_func_date_format : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_date_format s_singleton;
- protected:
- Create_func_date_format() {}
- virtual ~Create_func_date_format() {}
- };
- class Create_func_datediff : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_datediff s_singleton;
- protected:
- Create_func_datediff() {}
- virtual ~Create_func_datediff() {}
- };
- class Create_func_dayname : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_dayname s_singleton;
- protected:
- Create_func_dayname() {}
- virtual ~Create_func_dayname() {}
- };
- class Create_func_dayofmonth : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_dayofmonth s_singleton;
- protected:
- Create_func_dayofmonth() {}
- virtual ~Create_func_dayofmonth() {}
- };
- class Create_func_dayofweek : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_dayofweek s_singleton;
- protected:
- Create_func_dayofweek() {}
- virtual ~Create_func_dayofweek() {}
- };
- class Create_func_dayofyear : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_dayofyear s_singleton;
- protected:
- Create_func_dayofyear() {}
- virtual ~Create_func_dayofyear() {}
- };
- class Create_func_decode : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_decode s_singleton;
- protected:
- Create_func_decode() {}
- virtual ~Create_func_decode() {}
- };
- class Create_func_degrees : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_degrees s_singleton;
- protected:
- Create_func_degrees() {}
- virtual ~Create_func_degrees() {}
- };
- class Create_func_des_decrypt : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_des_decrypt s_singleton;
- protected:
- Create_func_des_decrypt() {}
- virtual ~Create_func_des_decrypt() {}
- };
- class Create_func_des_encrypt : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_des_encrypt s_singleton;
- protected:
- Create_func_des_encrypt() {}
- virtual ~Create_func_des_encrypt() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_dimension : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_dimension s_singleton;
- protected:
- Create_func_dimension() {}
- virtual ~Create_func_dimension() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_disjoint : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_disjoint s_singleton;
- protected:
- Create_func_disjoint() {}
- virtual ~Create_func_disjoint() {}
- };
- #endif
- class Create_func_elt : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_elt s_singleton;
- protected:
- Create_func_elt() {}
- virtual ~Create_func_elt() {}
- };
- class Create_func_encode : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_encode s_singleton;
- protected:
- Create_func_encode() {}
- virtual ~Create_func_encode() {}
- };
- class Create_func_encrypt : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_encrypt s_singleton;
- protected:
- Create_func_encrypt() {}
- virtual ~Create_func_encrypt() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_endpoint : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_endpoint s_singleton;
- protected:
- Create_func_endpoint() {}
- virtual ~Create_func_endpoint() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_envelope : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_envelope s_singleton;
- protected:
- Create_func_envelope() {}
- virtual ~Create_func_envelope() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_equals : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_equals s_singleton;
- protected:
- Create_func_equals() {}
- virtual ~Create_func_equals() {}
- };
- #endif
- class Create_func_exp : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_exp s_singleton;
- protected:
- Create_func_exp() {}
- virtual ~Create_func_exp() {}
- };
- class Create_func_export_set : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_export_set s_singleton;
- protected:
- Create_func_export_set() {}
- virtual ~Create_func_export_set() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_exteriorring : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_exteriorring s_singleton;
- protected:
- Create_func_exteriorring() {}
- virtual ~Create_func_exteriorring() {}
- };
- #endif
- class Create_func_field : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_field s_singleton;
- protected:
- Create_func_field() {}
- virtual ~Create_func_field() {}
- };
- class Create_func_find_in_set : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_find_in_set s_singleton;
- protected:
- Create_func_find_in_set() {}
- virtual ~Create_func_find_in_set() {}
- };
- class Create_func_floor : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_floor s_singleton;
- protected:
- Create_func_floor() {}
- virtual ~Create_func_floor() {}
- };
- class Create_func_format : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_format s_singleton;
- protected:
- Create_func_format() {}
- virtual ~Create_func_format() {}
- };
- class Create_func_found_rows : public Create_func_arg0
- {
- public:
- virtual Item *create(THD *thd);
- static Create_func_found_rows s_singleton;
- protected:
- Create_func_found_rows() {}
- virtual ~Create_func_found_rows() {}
- };
- class Create_func_from_days : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_from_days s_singleton;
- protected:
- Create_func_from_days() {}
- virtual ~Create_func_from_days() {}
- };
- class Create_func_from_unixtime : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_from_unixtime s_singleton;
- protected:
- Create_func_from_unixtime() {}
- virtual ~Create_func_from_unixtime() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_geometry_from_text : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_geometry_from_text s_singleton;
- protected:
- Create_func_geometry_from_text() {}
- virtual ~Create_func_geometry_from_text() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_geometry_from_wkb : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_geometry_from_wkb s_singleton;
- protected:
- Create_func_geometry_from_wkb() {}
- virtual ~Create_func_geometry_from_wkb() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_geometry_type : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_geometry_type s_singleton;
- protected:
- Create_func_geometry_type() {}
- virtual ~Create_func_geometry_type() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_geometryn : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_geometryn s_singleton;
- protected:
- Create_func_geometryn() {}
- virtual ~Create_func_geometryn() {}
- };
- #endif
- class Create_func_get_lock : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_get_lock s_singleton;
- protected:
- Create_func_get_lock() {}
- virtual ~Create_func_get_lock() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_glength : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_glength s_singleton;
- protected:
- Create_func_glength() {}
- virtual ~Create_func_glength() {}
- };
- #endif
- class Create_func_greatest : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_greatest s_singleton;
- protected:
- Create_func_greatest() {}
- virtual ~Create_func_greatest() {}
- };
- class Create_func_hex : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_hex s_singleton;
- protected:
- Create_func_hex() {}
- virtual ~Create_func_hex() {}
- };
- class Create_func_ifnull : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_ifnull s_singleton;
- protected:
- Create_func_ifnull() {}
- virtual ~Create_func_ifnull() {}
- };
- class Create_func_inet_ntoa : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_inet_ntoa s_singleton;
- protected:
- Create_func_inet_ntoa() {}
- virtual ~Create_func_inet_ntoa() {}
- };
- class Create_func_inet_aton : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_inet_aton s_singleton;
- protected:
- Create_func_inet_aton() {}
- virtual ~Create_func_inet_aton() {}
- };
- class Create_func_instr : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_instr s_singleton;
- protected:
- Create_func_instr() {}
- virtual ~Create_func_instr() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_interiorringn : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_interiorringn s_singleton;
- protected:
- Create_func_interiorringn() {}
- virtual ~Create_func_interiorringn() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_intersects : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_intersects s_singleton;
- protected:
- Create_func_intersects() {}
- virtual ~Create_func_intersects() {}
- };
- #endif
- class Create_func_is_free_lock : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_is_free_lock s_singleton;
- protected:
- Create_func_is_free_lock() {}
- virtual ~Create_func_is_free_lock() {}
- };
- class Create_func_is_used_lock : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_is_used_lock s_singleton;
- protected:
- Create_func_is_used_lock() {}
- virtual ~Create_func_is_used_lock() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_isclosed : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_isclosed s_singleton;
- protected:
- Create_func_isclosed() {}
- virtual ~Create_func_isclosed() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_isempty : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_isempty s_singleton;
- protected:
- Create_func_isempty() {}
- virtual ~Create_func_isempty() {}
- };
- #endif
- class Create_func_isnull : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_isnull s_singleton;
- protected:
- Create_func_isnull() {}
- virtual ~Create_func_isnull() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_issimple : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_issimple s_singleton;
- protected:
- Create_func_issimple() {}
- virtual ~Create_func_issimple() {}
- };
- #endif
- class Create_func_last_day : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_last_day s_singleton;
- protected:
- Create_func_last_day() {}
- virtual ~Create_func_last_day() {}
- };
- class Create_func_last_insert_id : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_last_insert_id s_singleton;
- protected:
- Create_func_last_insert_id() {}
- virtual ~Create_func_last_insert_id() {}
- };
- class Create_func_lcase : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_lcase s_singleton;
- protected:
- Create_func_lcase() {}
- virtual ~Create_func_lcase() {}
- };
- class Create_func_least : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_least s_singleton;
- protected:
- Create_func_least() {}
- virtual ~Create_func_least() {}
- };
- class Create_func_length : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_length s_singleton;
- protected:
- Create_func_length() {}
- virtual ~Create_func_length() {}
- };
- class Create_func_ln : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_ln s_singleton;
- protected:
- Create_func_ln() {}
- virtual ~Create_func_ln() {}
- };
- class Create_func_load_file : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_load_file s_singleton;
- protected:
- Create_func_load_file() {}
- virtual ~Create_func_load_file() {}
- };
- class Create_func_locate : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_locate s_singleton;
- protected:
- Create_func_locate() {}
- virtual ~Create_func_locate() {}
- };
- class Create_func_log : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_log s_singleton;
- protected:
- Create_func_log() {}
- virtual ~Create_func_log() {}
- };
- class Create_func_log10 : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_log10 s_singleton;
- protected:
- Create_func_log10() {}
- virtual ~Create_func_log10() {}
- };
- class Create_func_log2 : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_log2 s_singleton;
- protected:
- Create_func_log2() {}
- virtual ~Create_func_log2() {}
- };
- class Create_func_lpad : public Create_func_arg3
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
- static Create_func_lpad s_singleton;
- protected:
- Create_func_lpad() {}
- virtual ~Create_func_lpad() {}
- };
- class Create_func_ltrim : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_ltrim s_singleton;
- protected:
- Create_func_ltrim() {}
- virtual ~Create_func_ltrim() {}
- };
- class Create_func_makedate : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_makedate s_singleton;
- protected:
- Create_func_makedate() {}
- virtual ~Create_func_makedate() {}
- };
- class Create_func_maketime : public Create_func_arg3
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
- static Create_func_maketime s_singleton;
- protected:
- Create_func_maketime() {}
- virtual ~Create_func_maketime() {}
- };
- class Create_func_make_set : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_make_set s_singleton;
- protected:
- Create_func_make_set() {}
- virtual ~Create_func_make_set() {}
- };
- class Create_func_master_pos_wait : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_master_pos_wait s_singleton;
- protected:
- Create_func_master_pos_wait() {}
- virtual ~Create_func_master_pos_wait() {}
- };
- class Create_func_md5 : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_md5 s_singleton;
- protected:
- Create_func_md5() {}
- virtual ~Create_func_md5() {}
- };
- class Create_func_monthname : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_monthname s_singleton;
- protected:
- Create_func_monthname() {}
- virtual ~Create_func_monthname() {}
- };
- class Create_func_name_const : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_name_const s_singleton;
- protected:
- Create_func_name_const() {}
- virtual ~Create_func_name_const() {}
- };
- class Create_func_nullif : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_nullif s_singleton;
- protected:
- Create_func_nullif() {}
- virtual ~Create_func_nullif() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_numgeometries : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_numgeometries s_singleton;
- protected:
- Create_func_numgeometries() {}
- virtual ~Create_func_numgeometries() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_numinteriorring : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_numinteriorring s_singleton;
- protected:
- Create_func_numinteriorring() {}
- virtual ~Create_func_numinteriorring() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_numpoints : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_numpoints s_singleton;
- protected:
- Create_func_numpoints() {}
- virtual ~Create_func_numpoints() {}
- };
- #endif
- class Create_func_oct : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_oct s_singleton;
- protected:
- Create_func_oct() {}
- virtual ~Create_func_oct() {}
- };
- class Create_func_ord : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_ord s_singleton;
- protected:
- Create_func_ord() {}
- virtual ~Create_func_ord() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_overlaps : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_overlaps s_singleton;
- protected:
- Create_func_overlaps() {}
- virtual ~Create_func_overlaps() {}
- };
- #endif
- class Create_func_period_add : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_period_add s_singleton;
- protected:
- Create_func_period_add() {}
- virtual ~Create_func_period_add() {}
- };
- class Create_func_period_diff : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_period_diff s_singleton;
- protected:
- Create_func_period_diff() {}
- virtual ~Create_func_period_diff() {}
- };
- class Create_func_pi : public Create_func_arg0
- {
- public:
- virtual Item *create(THD *thd);
- static Create_func_pi s_singleton;
- protected:
- Create_func_pi() {}
- virtual ~Create_func_pi() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_pointn : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_pointn s_singleton;
- protected:
- Create_func_pointn() {}
- virtual ~Create_func_pointn() {}
- };
- #endif
- class Create_func_pow : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_pow s_singleton;
- protected:
- Create_func_pow() {}
- virtual ~Create_func_pow() {}
- };
- class Create_func_quote : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_quote s_singleton;
- protected:
- Create_func_quote() {}
- virtual ~Create_func_quote() {}
- };
- class Create_func_radians : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_radians s_singleton;
- protected:
- Create_func_radians() {}
- virtual ~Create_func_radians() {}
- };
- class Create_func_rand : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_rand s_singleton;
- protected:
- Create_func_rand() {}
- virtual ~Create_func_rand() {}
- };
- class Create_func_release_lock : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_release_lock s_singleton;
- protected:
- Create_func_release_lock() {}
- virtual ~Create_func_release_lock() {}
- };
- class Create_func_reverse : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_reverse s_singleton;
- protected:
- Create_func_reverse() {}
- virtual ~Create_func_reverse() {}
- };
- class Create_func_round : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_round s_singleton;
- protected:
- Create_func_round() {}
- virtual ~Create_func_round() {}
- };
- class Create_func_row_count : public Create_func_arg0
- {
- public:
- virtual Item *create(THD *thd);
- static Create_func_row_count s_singleton;
- protected:
- Create_func_row_count() {}
- virtual ~Create_func_row_count() {}
- };
- class Create_func_rpad : public Create_func_arg3
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
- static Create_func_rpad s_singleton;
- protected:
- Create_func_rpad() {}
- virtual ~Create_func_rpad() {}
- };
- class Create_func_rtrim : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_rtrim s_singleton;
- protected:
- Create_func_rtrim() {}
- virtual ~Create_func_rtrim() {}
- };
- class Create_func_sec_to_time : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_sec_to_time s_singleton;
- protected:
- Create_func_sec_to_time() {}
- virtual ~Create_func_sec_to_time() {}
- };
- class Create_func_sha : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_sha s_singleton;
- protected:
- Create_func_sha() {}
- virtual ~Create_func_sha() {}
- };
- class Create_func_sign : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_sign s_singleton;
- protected:
- Create_func_sign() {}
- virtual ~Create_func_sign() {}
- };
- class Create_func_sin : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_sin s_singleton;
- protected:
- Create_func_sin() {}
- virtual ~Create_func_sin() {}
- };
- class Create_func_sleep : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_sleep s_singleton;
- protected:
- Create_func_sleep() {}
- virtual ~Create_func_sleep() {}
- };
- class Create_func_soundex : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_soundex s_singleton;
- protected:
- Create_func_soundex() {}
- virtual ~Create_func_soundex() {}
- };
- class Create_func_space : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_space s_singleton;
- protected:
- Create_func_space() {}
- virtual ~Create_func_space() {}
- };
- class Create_func_sqrt : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_sqrt s_singleton;
- protected:
- Create_func_sqrt() {}
- virtual ~Create_func_sqrt() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_srid : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_srid s_singleton;
- protected:
- Create_func_srid() {}
- virtual ~Create_func_srid() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_startpoint : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_startpoint s_singleton;
- protected:
- Create_func_startpoint() {}
- virtual ~Create_func_startpoint() {}
- };
- #endif
- class Create_func_str_to_date : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_str_to_date s_singleton;
- protected:
- Create_func_str_to_date() {}
- virtual ~Create_func_str_to_date() {}
- };
- class Create_func_strcmp : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_strcmp s_singleton;
- protected:
- Create_func_strcmp() {}
- virtual ~Create_func_strcmp() {}
- };
- class Create_func_substr_index : public Create_func_arg3
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
- static Create_func_substr_index s_singleton;
- protected:
- Create_func_substr_index() {}
- virtual ~Create_func_substr_index() {}
- };
- class Create_func_subtime : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_subtime s_singleton;
- protected:
- Create_func_subtime() {}
- virtual ~Create_func_subtime() {}
- };
- class Create_func_tan : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_tan s_singleton;
- protected:
- Create_func_tan() {}
- virtual ~Create_func_tan() {}
- };
- class Create_func_time_format : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_time_format s_singleton;
- protected:
- Create_func_time_format() {}
- virtual ~Create_func_time_format() {}
- };
- class Create_func_time_to_sec : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_time_to_sec s_singleton;
- protected:
- Create_func_time_to_sec() {}
- virtual ~Create_func_time_to_sec() {}
- };
- class Create_func_timediff : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_timediff s_singleton;
- protected:
- Create_func_timediff() {}
- virtual ~Create_func_timediff() {}
- };
- class Create_func_to_days : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_to_days s_singleton;
- protected:
- Create_func_to_days() {}
- virtual ~Create_func_to_days() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_touches : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_touches s_singleton;
- protected:
- Create_func_touches() {}
- virtual ~Create_func_touches() {}
- };
- #endif
- class Create_func_ucase : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_ucase s_singleton;
- protected:
- Create_func_ucase() {}
- virtual ~Create_func_ucase() {}
- };
- class Create_func_uncompress : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_uncompress s_singleton;
- protected:
- Create_func_uncompress() {}
- virtual ~Create_func_uncompress() {}
- };
- class Create_func_uncompressed_length : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_uncompressed_length s_singleton;
- protected:
- Create_func_uncompressed_length() {}
- virtual ~Create_func_uncompressed_length() {}
- };
- class Create_func_unhex : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_unhex s_singleton;
- protected:
- Create_func_unhex() {}
- virtual ~Create_func_unhex() {}
- };
- class Create_func_unix_timestamp : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_unix_timestamp s_singleton;
- protected:
- Create_func_unix_timestamp() {}
- virtual ~Create_func_unix_timestamp() {}
- };
- class Create_func_uuid : public Create_func_arg0
- {
- public:
- virtual Item *create(THD *thd);
- static Create_func_uuid s_singleton;
- protected:
- Create_func_uuid() {}
- virtual ~Create_func_uuid() {}
- };
- class Create_func_uuid_short : public Create_func_arg0
- {
- public:
- virtual Item *create(THD *thd);
- static Create_func_uuid_short s_singleton;
- protected:
- Create_func_uuid_short() {}
- virtual ~Create_func_uuid_short() {}
- };
- class Create_func_version : public Create_func_arg0
- {
- public:
- virtual Item *create(THD *thd);
- static Create_func_version s_singleton;
- protected:
- Create_func_version() {}
- virtual ~Create_func_version() {}
- };
- class Create_func_weekday : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_weekday s_singleton;
- protected:
- Create_func_weekday() {}
- virtual ~Create_func_weekday() {}
- };
- class Create_func_weekofyear : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_weekofyear s_singleton;
- protected:
- Create_func_weekofyear() {}
- virtual ~Create_func_weekofyear() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_within : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_within s_singleton;
- protected:
- Create_func_within() {}
- virtual ~Create_func_within() {}
- };
- #endif
- #ifdef HAVE_SPATIAL
- class Create_func_x : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_x s_singleton;
- protected:
- Create_func_x() {}
- virtual ~Create_func_x() {}
- };
- #endif
- class Create_func_xml_extractvalue : public Create_func_arg2
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2);
- static Create_func_xml_extractvalue s_singleton;
- protected:
- Create_func_xml_extractvalue() {}
- virtual ~Create_func_xml_extractvalue() {}
- };
- class Create_func_xml_update : public Create_func_arg3
- {
- public:
- virtual Item *create(THD *thd, Item *arg1, Item *arg2, Item *arg3);
- static Create_func_xml_update s_singleton;
- protected:
- Create_func_xml_update() {}
- virtual ~Create_func_xml_update() {}
- };
- #ifdef HAVE_SPATIAL
- class Create_func_y : public Create_func_arg1
- {
- public:
- virtual Item *create(THD *thd, Item *arg1);
- static Create_func_y s_singleton;
- protected:
- Create_func_y() {}
- virtual ~Create_func_y() {}
- };
- #endif
- class Create_func_year_week : public Create_native_func
- {
- public:
- virtual Item *create_native(THD *thd, LEX_STRING name, List<Item> *item_list);
- static Create_func_year_week s_singleton;
- protected:
- Create_func_year_week() {}
- virtual ~Create_func_year_week() {}
- };
- /*
- =============================================================================
- IMPLEMENTATION
- =============================================================================
- */
- /**
- Checks if there are named parameters in a parameter list.
- The syntax to name parameters in a function call is as follow:
- <code>foo(expr AS named, expr named, expr AS "named", expr "named")</code>
- @param params The parameter list, can be null
- @return true if one or more parameter is named
- */
- static bool has_named_parameters(List<Item> *params)
- {
- if (params)
- {
- Item *param;
- List_iterator<Item> it(*params);
- while ((param= it++))
- {
- if (! param->is_autogenerated_name)
- return true;
- }
- }
- return false;
- }
- #ifndef HAVE_SPATIAL
- Create_func_no_geom Create_func_no_geom::s_singleton;
- Item*
- Create_func_no_geom::create_func(THD * /* unused */,
- LEX_STRING /* unused */,
- List<Item> * /* unused */)
- {
- /* FIXME: error message can't be translated. */
- my_error(ER_FEATURE_DISABLED, MYF(0),
- sym_group_geom.name, sym_group_geom.needed_define);
- return NULL;
- }
- #endif
- Item*
- Create_qfunc::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
- {
- LEX_STRING db;
- if (! thd->db && ! thd->lex->sphead)
- {
- /*
- The proper error message should be in the lines of:
- Can't resolve <name>() to a function call,
- because this function:
- - is not a native function,
- - is not a user defined function,
- - can not match a qualified (read: stored) function
- since no database is selected.
- Reusing ER_SP_DOES_NOT_EXIST have a message consistent with
- the case when a default database exist, see Create_sp_func::create().
- */
- my_error(ER_SP_DOES_NOT_EXIST, MYF(0),
- "FUNCTION", name.str);
- return NULL;
- }
- if (thd->lex->copy_db_to(&db.str, &db.length))
- return NULL;
- return create(thd, db, name, false, item_list);
- }
- #ifdef HAVE_DLOPEN
- Create_udf_func Create_udf_func::s_singleton;
- Item*
- Create_udf_func::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
- {
- udf_func *udf= find_udf(name.str, name.length);
- DBUG_ASSERT(udf);
- return create(thd, udf, item_list);
- }
- Item*
- Create_udf_func::create(THD *thd, udf_func *udf, List<Item> *item_list)
- {
- Item *func= NULL;
- int arg_count= 0;
- if (item_list != NULL)
- arg_count= item_list->elements;
- thd->lex->set_stmt_unsafe();
- DBUG_ASSERT( (udf->type == UDFTYPE_FUNCTION)
- || (udf->type == UDFTYPE_AGGREGATE));
- switch(udf->returns) {
- case STRING_RESULT:
- {
- if (udf->type == UDFTYPE_FUNCTION)
- {
- if (arg_count)
- func= new (thd->mem_root) Item_func_udf_str(udf, *item_list);
- else
- func= new (thd->mem_root) Item_func_udf_str(udf);
- }
- else
- {
- if (arg_count)
- func= new (thd->mem_root) Item_sum_udf_str(udf, *item_list);
- else
- func= new (thd->mem_root) Item_sum_udf_str(udf);
- }
- break;
- }
- case REAL_RESULT:
- {
- if (udf->type == UDFTYPE_FUNCTION)
- {
- if (arg_count)
- func= new (thd->mem_root) Item_func_udf_float(udf, *item_list);
- else
- func= new (thd->mem_root) Item_func_udf_float(udf);
- }
- else
- {
- if (arg_count)
- func= new (thd->mem_root) Item_sum_udf_float(udf, *item_list);
- else
- func= new (thd->mem_root) Item_sum_udf_float(udf);
- }
- break;
- }
- case INT_RESULT:
- {
- if (udf->type == UDFTYPE_FUNCTION)
- {
- if (arg_count)
- func= new (thd->mem_root) Item_func_udf_int(udf, *item_list);
- else
- func= new (thd->mem_root) Item_func_udf_int(udf);
- }
- else
- {
- if (arg_count)
- func= new (thd->mem_root) Item_sum_udf_int(udf, *item_list);
- else
- func= new (thd->mem_root) Item_sum_udf_int(udf);
- }
- break;
- }
- case DECIMAL_RESULT:
- {
- if (udf->type == UDFTYPE_FUNCTION)
- {
- if (arg_count)
- func= new (thd->mem_root) Item_func_udf_decimal(udf, *item_list);
- else
- func= new (thd->mem_root) Item_func_udf_decimal(udf);
- }
- else
- {
- if (arg_count)
- func= new (thd->mem_root) Item_sum_udf_decimal(udf, *item_list);
- else
- func= new (thd->mem_root) Item_sum_udf_decimal(udf);
- }
- break;
- }
- default:
- {
- my_error(ER_NOT_SUPPORTED_YET, MYF(0), "UDF return type");
- }
- }
- thd->lex->safe_to_cache_query= 0;
- return func;
- }
- #endif
- Create_sp_func Create_sp_func::s_singleton;
- Item*
- Create_sp_func::create(THD *thd, LEX_STRING db, LEX_STRING name,
- bool use_explicit_name, List<Item> *item_list)
- {
- int arg_count= 0;
- Item *func= NULL;
- LEX *lex= thd->lex;
- sp_name *qname;
- if (has_named_parameters(item_list))
- {
- /*
- The syntax "db.foo(expr AS p1, expr AS p2, ...) is invalid,
- and has been rejected during syntactic parsing already,
- because a stored function call may not have named parameters.
- The syntax "foo(expr AS p1, expr AS p2, ...)" is correct,
- because it can refer to a User Defined Function call.
- For a Stored Function however, this has no semantic.
- */
- my_error(ER_WRONG_PARAMETERS_TO_STORED_FCT, MYF(0), name.str);
- return NULL;
- }
- if (item_list != NULL)
- arg_count= item_list->elements;
- qname= new (thd->mem_root) sp_name(db, name, use_explicit_name);
- qname->init_qname(thd);
- sp_add_used_routine(lex, thd, qname, TYPE_ENUM_FUNCTION);
- if (arg_count > 0)
- func= new (thd->mem_root) Item_func_sp(lex->current_context(), qname,
- *item_list);
- else
- func= new (thd->mem_root) Item_func_sp(lex->current_context(), qname);
- lex->safe_to_cache_query= 0;
- return func;
- }
- Item*
- Create_native_func::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
- {
- if (has_named_parameters(item_list))
- {
- my_error(ER_WRONG_PARAMETERS_TO_NATIVE_FCT, MYF(0), name.str);
- return NULL;
- }
- return create_native(thd, name, item_list);
- }
- Item*
- Create_func_arg0::create_func(THD *thd, LEX_STRING name, List<Item> *item_list)
- {
- int arg_count= 0;
- if (item_list != NULL)
- arg_count= item_list->elements;
- if (arg_count != 0)
- {
- my_error(ER_WRONG_PARAMCOUNT_TO_NATIVE_FCT, MYF(0)