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 {
00029 
00041 class Create_func
00042 {
00043 public:
00065   virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list) = 0;
00066 
00067 protected:
00069   Create_func() {}
00071   virtual ~Create_func() {}
00072 };
00073 
00080 class Create_qfunc : public Create_func
00081 {
00082 public:
00091   virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list);
00092 
00102   virtual Item* create(Session *session, LEX_STRING db, LEX_STRING name,
00103                        bool use_explicit_name, List<Item> *item_list) = 0;
00104 
00105 protected:
00107   Create_qfunc() {}
00109   virtual ~Create_qfunc() {}
00110 };
00111 
00112 
00118 extern Create_func * find_native_function_builder(LEX_STRING name);
00119 
00120 
00126 extern Create_qfunc * find_qualified_function_builder(Session *session);
00127 
00128 
00133 class Create_udf_func : public Create_func
00134 {
00135 public:
00136   virtual Item *create(Session *session, LEX_STRING name, List<Item> *item_list);
00137 
00145   Item *create(Session *session,
00146                const plugin::Function *fct,
00147                List<Item> *item_list);
00148 
00150   static Create_udf_func s_singleton;
00151 
00152 protected:
00154   Create_udf_func() {}
00156   virtual ~Create_udf_func() {}
00157 };
00158 
00159 Item*
00160 create_func_char_cast(Session *session, Item *a, int len, const CHARSET_INFO * const cs);
00161 
00171 Item *
00172 create_func_cast(Session *session, Item *a, Cast_target cast_type,
00173                  const char *len, const char *dec,
00174                  const CHARSET_INFO * const cs);
00175 
00176 int item_create_init();
00177 void item_create_cleanup();
00178 
00179 } /* namespace drizzled */
00180