Drizzled Public API Documentation

index_hint.h
Go to the documentation of this file.
1 /* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
3  *
4  * Copyright (C) 2008-2009 Sun Microsystems, Inc.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
27 #pragma once
28 
29 namespace drizzled {
30 
31 /*
32  String names used to print a statement with index hints.
33  Keep in sync with index_hint_type.
34 */
35 extern const char* index_hint_type_name[];
36 typedef unsigned char index_clause_map;
37 
38 enum index_hint_type
39 {
40  INDEX_HINT_IGNORE,
41  INDEX_HINT_USE,
42  INDEX_HINT_FORCE
43 };
44 
45 /*
46  Bits in index_clause_map : one for each possible FOR clause in
47  USE/FORCE/IGNORE INDEX index hint specification
48 */
49 #define INDEX_HINT_MASK_JOIN (1)
50 #define INDEX_HINT_MASK_GROUP (1 << 1)
51 #define INDEX_HINT_MASK_ORDER (1 << 2)
52 
53 #define INDEX_HINT_MASK_ALL (INDEX_HINT_MASK_JOIN | INDEX_HINT_MASK_GROUP | INDEX_HINT_MASK_ORDER)
54 
55 /* Single element of an USE/FORCE/IGNORE INDEX list specified as a SQL hint */
57 {
58 public:
59  /* The type of the hint : USE/FORCE/IGNORE */
60  index_hint_type type;
61  /* Where the hit applies to. A bitmask of INDEX_HINT_MASK_<place> values */
62  index_clause_map clause;
63  /*
64  The index name. Empty (str=NULL) name represents an empty list
65  USE INDEX () clause
66  */
67  const char* key_name;
68 
69  Index_hint(index_hint_type type_arg, index_clause_map clause_arg, const char *str) :
70  type(type_arg), clause(clause_arg), key_name(str)
71  {
72  }
73 
74  void print(String&) const;
75 };
76 
77 } /* namespace drizzled */
TODO: Rename this file - func.h is stupid.
void print(String &) const
Definition: index_hint.cc:57