Drizzled Public API Documentation

function.h
00001 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2009 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; either version 2 of the License, or
00009  *  (at your option) any later version.
00010  *
00011  *  This program is distributed in the hope that it will be useful,
00012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *  GNU General Public License for more details.
00015  *
00016  *  You should have received a copy of the GNU General Public License
00017  *  along with this program; if not, write to the Free Software
00018  *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00019  */
00020 
00021 #pragma once
00022 
00023 #include <assert.h>
00024 #include <drizzled/plugin/storage_engine.h>
00025 #include <drizzled/plugin/table_function.h>
00026 #include <drizzled/identifier/schema.h>
00027 
00028 extern const drizzled::CHARSET_INFO *default_charset_info;
00029 
00030 static const char *function_exts[] = {
00031   NULL
00032 };
00033 
00034 class Function : public drizzled::plugin::StorageEngine
00035 {
00036   drizzled::message::schema::shared_ptr information_message;
00037   drizzled::message::schema::shared_ptr data_dictionary_message;
00038 
00039 public:
00040   Function(const std::string &name_arg);
00041 
00042   ~Function()
00043   { }
00044 
00045   drizzled::plugin::TableFunction *getTool(const char *name_arg);
00046 
00047   int doCreateTable(drizzled::Session&,
00048                     drizzled::Table&,
00049                     const drizzled::identifier::Table &,
00050                     const drizzled::message::Table&)
00051   {
00052     return drizzled::ER_TABLE_PERMISSION_DENIED;
00053   }
00054 
00055   int doDropTable(drizzled::Session&, const drizzled::identifier::Table&)
00056   { 
00057     return drizzled::HA_ERR_NO_SUCH_TABLE; 
00058   }
00059 
00060   virtual drizzled::Cursor *create(drizzled::Table &table);
00061 
00062   const char **bas_ext() const 
00063   {
00064     return function_exts;
00065   }
00066 
00067   drizzled::plugin::TableFunction *getFunction(const std::string &path)
00068   {
00069     return drizzled::plugin::TableFunction::getFunction(path);
00070   }
00071 
00072   bool doCanCreateTable(const drizzled::identifier::Table &identifier);
00073 
00074 
00075   int doGetTableDefinition(drizzled::Session &session,
00076                            const drizzled::identifier::Table &identifier,
00077                            drizzled::message::Table &table_message);
00078 
00079   void doGetSchemaIdentifiers(drizzled::identifier::Schema::vector&);
00080 
00081   bool doDoesTableExist(drizzled::Session& session, const drizzled::identifier::Table &identifier);
00082 
00083   drizzled::message::schema::shared_ptr doGetSchemaDefinition(const drizzled::identifier::Schema &schema);
00084 
00085   int doRenameTable(drizzled::Session&, const drizzled::identifier::Table &, const drizzled::identifier::Table &)
00086   {
00087     return EPERM;
00088   }
00089 
00090   void doGetTableIdentifiers(drizzled::CachedDirectory &directory,
00091                              const drizzled::identifier::Schema &schema_identifier,
00092                              drizzled::identifier::Table::vector &set_of_identifiers);
00093 };
00094