1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2010 Padraig O'Sullivan
8
* Padraig O'Sullivan <posullivan@akibainc.com>
10
* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; version 2 of the License.
14
* This program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public License
20
* along with this program; if not, write to the Free Software
21
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
#include "drizzled/plugin/query_rewrite.h"
26
#include "drizzled/gettext.h"
27
#include "drizzled/plugin/registry.h"
39
vector<plugin::QueryRewriter *> all_rewriters;
42
bool QueryRewriter::addPlugin(QueryRewriter *in_rewriter)
44
if (in_rewriter != NULL)
46
all_rewriters.push_back(in_rewriter);
52
void QueryRewriter::removePlugin(QueryRewriter *in_rewriter)
54
if (in_rewriter != NULL)
56
all_rewriters.erase(find(all_rewriters.begin(),
64
* This is the QueryRewriter::rewrite entry point.
65
* This gets called from within the Drizzle kernel.
67
void QueryRewriter::rewriteQuery(string &to_rewrite)
69
for (vector<plugin::QueryRewriter *>::iterator iter= all_rewriters.begin();
70
iter != all_rewriters.end();
73
(*iter)->rewrite(to_rewrite);
77
} /* namespace plugin */
79
} /* namespace drizzled */