My Project
|
00001 /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; version 2 of the License. 00006 00007 This program is distributed in the hope that it will be useful, 00008 but WITHOUT ANY WARRANTY; without even the implied warranty of 00009 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00010 GNU General Public License for more details. 00011 00012 You should have received a copy of the GNU General Public License 00013 along with this program; if not, write to the Free Software 00014 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ 00015 00016 /* Functions to create an item. Used by sql/sql_yacc.yy */ 00017 00018 #ifndef ITEM_CREATE_H 00019 #define ITEM_CREATE_H 00020 00021 typedef struct st_udf_func udf_func; 00022 00034 class Create_func 00035 { 00036 public: 00058 virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list) = 0; 00059 00060 protected: 00062 Create_func() {} 00064 virtual ~Create_func() {} 00065 }; 00066 00067 00074 class Create_qfunc : public Create_func 00075 { 00076 public: 00085 virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list); 00086 00096 virtual Item* create(THD *thd, LEX_STRING db, LEX_STRING name, 00097 bool use_explicit_name, List<Item> *item_list) = 0; 00098 00099 protected: 00101 Create_qfunc() {} 00103 virtual ~Create_qfunc() {} 00104 }; 00105 00106 00113 extern Create_func * find_native_function_builder(THD *thd, LEX_STRING name); 00114 00115 00121 extern Create_qfunc * find_qualified_function_builder(THD *thd); 00122 00123 00124 #ifdef HAVE_DLOPEN 00125 00129 class Create_udf_func : public Create_func 00130 { 00131 public: 00132 virtual Item *create_func(THD *thd, LEX_STRING name, List<Item> *item_list); 00133 00141 Item *create(THD *thd, udf_func *fct, List<Item> *item_list); 00142 00144 static Create_udf_func s_singleton; 00145 00146 protected: 00148 Create_udf_func() {} 00150 virtual ~Create_udf_func() {} 00151 }; 00152 #endif 00153 00154 00164 Item * 00165 create_func_cast(THD *thd, Item *a, Cast_target cast_type, 00166 const char *len, const char *dec, 00167 const CHARSET_INFO *cs); 00168 00169 Item *create_temporal_literal(THD *thd, 00170 const char *str, uint length, 00171 const CHARSET_INFO *cs, 00172 enum_field_types type, bool send_error); 00173 00174 int item_create_init(); 00175 void item_create_cleanup(); 00176 00177 #endif 00178