Drizzled Public API Documentation

create.h
00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2008 Sun Microsystems, Inc.
00005  *
00006  *  This program is free software; you can redistribute it and/or modify
00007  *  it under the terms of the GNU General Public License as published by
00008  *  the Free Software Foundation; version 2 of the License.
00009  *
00010  *  This program is distributed in the hope that it will be useful,
00011  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *  GNU General Public License for more details.
00014  *
00015  *  You should have received a copy of the GNU General Public License
00016  *  along with this program; if not, write to the Free Software
00017  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00018  */
00019 
00020 /* Functions to create an item. Used by sql/sql_yacc.yy */
00021 
00022 #pragma once
00023 
00024 #include <drizzled/item/func.h>
00025 #include <drizzled/plugin/function.h>
00026 
00027 namespace drizzled {
00028 
00040 class Create_func
00041 {
00042 public:
00064   virtual Item *create(Session*, str_ref name, List<Item> *item_list) = 0;
00065 
00066 protected:
00067   virtual ~Create_func() {}
00068 };
00069 
00076 class Create_qfunc : public Create_func
00077 {
00078 public:
00087   virtual Item *create(Session*, str_ref name, List<Item> *item_list);
00088 
00098   virtual Item* create(Session*, str_ref db, str_ref name, bool use_explicit_name, List<Item>*) = 0;
00099 };
00100 
00101 
00107 extern Create_func* find_native_function_builder(str_ref name);
00108 
00109 
00115 extern Create_qfunc* find_qualified_function_builder(Session*);
00116 
00117 
00122 class Create_udf_func : public Create_func
00123 {
00124 public:
00125   virtual Item *create(Session*, str_ref name, List<Item> *item_list);
00126 
00134   Item *create(Session*, const plugin::Function *fct, List<Item> *item_list);
00135 
00137   static Create_udf_func s_singleton;
00138 
00139 protected:
00141   Create_udf_func() {}
00142 };
00143 
00144 Item*
00145 create_func_char_cast(Session*, Item *a, int len, const charset_info_st * const cs);
00146 
00156 Item *
00157 create_func_cast(Session*, Item *a, Cast_target cast_type, const char *len, const char *dec, const charset_info_st*);
00158 
00159 void item_create_init();
00160 void item_create_cleanup();
00161 
00162 } /* namespace drizzled */
00163