00001 /* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*- 00002 * vim:expandtab:shiftwidth=2:tabstop=2:smarttab: 00003 * 00004 * Copyright (C) 2010 Padraig O'Sullivan 00005 * 00006 * Authors: 00007 * 00008 * Padraig O'Sullivan <posullivan@akibainc.com> 00009 * 00010 * This program is free software; you can redistribute it and/or modify 00011 * it under the terms of the GNU General Public License as published by 00012 * the Free Software Foundation; version 2 of the License. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 */ 00023 00024 #pragma once 00025 00026 #include <drizzled/atomics.h> 00027 #include <drizzled/plugin/plugin.h> 00028 00029 #include <drizzled/visibility.h> 00030 00035 namespace drizzled 00036 { 00037 00038 namespace plugin 00039 { 00040 00044 class DRIZZLED_API QueryRewriter : public Plugin 00045 { 00046 public: 00047 explicit QueryRewriter(std::string name_arg) 00048 : 00049 Plugin(name_arg, "QueryRewriter") 00050 {} 00051 00058 virtual void rewrite(const std::string &schema, std::string &to_rewrite)= 0; 00059 00060 static bool addPlugin(QueryRewriter *in_rewriter); 00061 static void removePlugin(QueryRewriter *in_rewriter); 00062 00071 static void rewriteQuery(const std::string &schema, std::string &to_rewrite); 00072 }; 00073 00074 } /* namespace plugin */ 00075 } /* namespace drizzled */ 00076