~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/query_rewrite.cc

  • Committer: Padraig O'Sullivan
  • Date: 2009-09-13 01:03:01 UTC
  • mto: (1126.9.2 captain-20090915-01)
  • mto: This revision was merged to the branch mainline in revision 1133.
  • Revision ID: osullivan.padraig@gmail.com-20090913010301-tcvvezipx1124acy
Added calls to the dtrace delete begin/end probes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
 
 *  vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3
 
 *
4
 
 *  Copyright (C) 2010 Padraig O'Sullivan
5
 
 *
6
 
 *  Authors:
7
 
 *
8
 
 *    Padraig O'Sullivan <posullivan@akibainc.com>
9
 
 *
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.
13
 
 *
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.
18
 
 *
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
22
 
 */
23
 
 
24
 
#include "config.h"
25
 
#include "drizzled/plugin/query_rewrite.h"
26
 
#include "drizzled/gettext.h"
27
 
#include "drizzled/plugin/registry.h"
28
 
 
29
 
#include <vector>
30
 
 
31
 
using namespace std;
32
 
 
33
 
namespace drizzled
34
 
{
35
 
 
36
 
namespace plugin
37
 
{
38
 
 
39
 
vector<plugin::QueryRewriter *> all_rewriters;
40
 
 
41
 
 
42
 
bool QueryRewriter::addPlugin(QueryRewriter *in_rewriter)
43
 
{
44
 
  if (in_rewriter != NULL)
45
 
  {
46
 
    all_rewriters.push_back(in_rewriter);
47
 
  }
48
 
  return false;
49
 
}
50
 
 
51
 
 
52
 
void QueryRewriter::removePlugin(QueryRewriter *in_rewriter)
53
 
{
54
 
  if (in_rewriter != NULL)
55
 
  {
56
 
    all_rewriters.erase(find(all_rewriters.begin(),
57
 
                             all_rewriters.end(),
58
 
                             in_rewriter));
59
 
  }
60
 
}
61
 
 
62
 
 
63
 
/*
64
 
 * This is the QueryRewriter::rewrite entry point.
65
 
 * This gets called from within the Drizzle kernel.
66
 
 */
67
 
void QueryRewriter::rewriteQuery(const string &schema, string &to_rewrite)
68
 
{
69
 
  for (vector<plugin::QueryRewriter *>::iterator iter= all_rewriters.begin();
70
 
       iter != all_rewriters.end();
71
 
       ++iter)
72
 
  {
73
 
    (*iter)->rewrite(schema, to_rewrite);
74
 
  }
75
 
}
76
 
 
77
 
} /* namespace plugin */
78
 
 
79
 
} /* namespace drizzled */