Drizzled Public API Documentation

schema.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 /* 
00022   This is a "work in progress". The concept needs to be replicated throughout
00023   the code, but we will start with baby steps for the moment. To not incur
00024   cost until we are complete, for the moment it will do no allocation.
00025 
00026   This is mainly here so that it can be used in the SE interface for
00027   the time being.
00028 
00029   This will replace Table_ident.
00030   */
00031 
00032 #pragma once
00033 
00034 #include <boost/algorithm/string.hpp>
00035 #include <ostream>
00036 
00037 namespace drizzled {
00038 namespace identifier {
00039 
00040 class DRIZZLED_API Schema : public Identifier
00041 {
00042   std::string db;
00043   std::string db_path;
00044 
00045 public:
00046   Schema(str_ref);
00047 
00048   virtual std::string getSQLPath() const
00049   {
00050     return db;
00051   }
00052 
00053   const std::string &getPath() const;
00054 
00055   const std::string &getSchemaName() const
00056   {
00057     return db;
00058   }
00059 
00060   const std::string &getCatalogName() const;
00061 
00062   virtual bool isValid() const;
00063 
00064   inline virtual bool isSystem() const
00065   {
00066     return false;
00067   }
00068 
00069   bool compare(const std::string &arg) const;
00070   bool compare(const Schema&) const;
00071 
00072   friend bool operator<(const Schema& left, const Schema& right)
00073   {
00074     return boost::ilexicographical_compare(left.getSchemaName(), right.getSchemaName());
00075   }
00076 
00077   friend bool operator==(const Schema& left, const Schema& right)
00078   {
00079     return boost::iequals(left.getSchemaName(), right.getSchemaName());
00080   }
00081 };
00082 
00083 std::ostream& operator<<(std::ostream&, const Schema&);
00084 
00085 
00086 } /* namespace identifier */
00087 } /* namespace drizzled */