1
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008-2009 Sun Microsystems
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.
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.
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
24
* Defines the API for index hints
27
#ifndef DRIZZLED_INDEX_HINT_H
28
#define DRIZZLED_INDEX_HINT_H
34
String names used to print a statement with index hints.
35
Keep in sync with index_hint_type.
37
extern const char * index_hint_type_name[];
38
typedef unsigned char index_clause_map;
48
Bits in index_clause_map : one for each possible FOR clause in
49
USE/FORCE/IGNORE INDEX index hint specification
51
#define INDEX_HINT_MASK_JOIN (1)
52
#define INDEX_HINT_MASK_GROUP (1 << 1)
53
#define INDEX_HINT_MASK_ORDER (1 << 2)
55
#define INDEX_HINT_MASK_ALL (INDEX_HINT_MASK_JOIN | INDEX_HINT_MASK_GROUP | \
56
INDEX_HINT_MASK_ORDER)
58
/* Single element of an USE/FORCE/IGNORE INDEX list specified as a SQL hint */
59
class Index_hint : public memory::SqlAlloc
62
/* The type of the hint : USE/FORCE/IGNORE */
63
enum index_hint_type type;
64
/* Where the hit applies to. A bitmask of INDEX_HINT_MASK_<place> values */
65
index_clause_map clause;
67
The index name. Empty (str=NULL) name represents an empty list
72
Index_hint (enum index_hint_type type_arg, index_clause_map clause_arg,
73
char *str, uint32_t length) :
74
type(type_arg), clause(clause_arg)
77
key_name.length= length;
80
void print(Session *session, String *str);
83
} /* namespace drizzled */
85
#endif /* DRIZZLED_INDEX_HINT_H */