Drizzled Public API Documentation

schemata.cc
00001 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
00002  *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
00003  *
00004  *  Copyright (C) 2010 Brian Aker
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 #include <config.h>
00022 #include <plugin/information_schema_dictionary/dictionary.h>
00023 
00024 using namespace std;
00025 using namespace drizzled;
00026 
00027 Schemata::Schemata() :
00028   InformationSchema("SCHEMATA")
00029 {
00030   add_field("CATALOG_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, false);
00031   add_field("SCHEMA_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, false);
00032   add_field("SCHEMA_OWNER", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, true);
00033   add_field("DEFAULT_CHARACTER_SET_CATALOG", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, true);
00034   add_field("DEFAULT_CHARACTER_SET_SCHEMA", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, true);
00035   add_field("DEFAULT_CHARACTER_SET_NAME", plugin::TableFunction::STRING, MAXIMUM_IDENTIFIER_LENGTH, true);
00036 }
00037 
00038 Schemata::Generator::Generator(drizzled::Field **arg) :
00039   InformationSchema::Generator(arg),
00040   schema_generator(getSession())
00041 {
00042 }
00043 
00044 bool Schemata::Generator::populate()
00045 {
00046   drizzled::message::schema::shared_ptr schema_ptr;
00047 
00048   while ((schema_ptr= schema_generator))
00049   {
00050     /* CATALOG_NAME */
00051     push(schema_ptr->catalog());
00052 
00053     /* SCHEMA_NAME */
00054     push(schema_ptr->name());
00055 
00056     /* SCHEMA_OWNER */
00057     push();
00058 
00059     /* DEFAULT_CHARACTER_SET_CATALOG */
00060     push();
00061 
00062     /* DEFAULT_CHARACTER_SET_SCHEMA */
00063     push();
00064 
00065     /* DEFAULT_CHARACTER_SET_NAME */
00066     push();
00067 
00068     return true;
00069   }
00070 
00071   return false;
00072 }