934.2.2
by Jay Pipes
Forgot to add the new files... |
1 |
/* - mode: c; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
1999.6.1
by kalebral at gmail
update Copyright strings to a more common format to help with creating the master debian copyright file |
4 |
* Copyright (C) 2008-2009 Sun Microsystems, Inc.
|
934.2.2
by Jay Pipes
Forgot to add the new files... |
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 |
||
21 |
/**
|
|
22 |
* @file
|
|
23 |
*
|
|
24 |
* Defines the API for index hints
|
|
25 |
*/
|
|
26 |
||
2234
by Brian Aker
Mass removal of ifdef/endif in favor of pragma once. |
27 |
#pragma once
|
934.2.2
by Jay Pipes
Forgot to add the new files... |
28 |
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
29 |
namespace drizzled |
30 |
{
|
|
31 |
||
934.2.2
by Jay Pipes
Forgot to add the new files... |
32 |
/*
|
33 |
String names used to print a statement with index hints.
|
|
34 |
Keep in sync with index_hint_type.
|
|
35 |
*/
|
|
36 |
extern const char * index_hint_type_name[]; |
|
37 |
typedef unsigned char index_clause_map; |
|
38 |
||
39 |
enum index_hint_type |
|
40 |
{
|
|
41 |
INDEX_HINT_IGNORE, |
|
42 |
INDEX_HINT_USE, |
|
43 |
INDEX_HINT_FORCE
|
|
44 |
};
|
|
45 |
||
46 |
/*
|
|
47 |
Bits in index_clause_map : one for each possible FOR clause in
|
|
48 |
USE/FORCE/IGNORE INDEX index hint specification
|
|
49 |
*/
|
|
50 |
#define INDEX_HINT_MASK_JOIN (1)
|
|
51 |
#define INDEX_HINT_MASK_GROUP (1 << 1)
|
|
52 |
#define INDEX_HINT_MASK_ORDER (1 << 2)
|
|
53 |
||
54 |
#define INDEX_HINT_MASK_ALL (INDEX_HINT_MASK_JOIN | INDEX_HINT_MASK_GROUP | \
|
|
55 |
INDEX_HINT_MASK_ORDER)
|
|
56 |
||
57 |
/* Single element of an USE/FORCE/IGNORE INDEX list specified as a SQL hint */
|
|
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
58 |
class Index_hint : public memory::SqlAlloc |
934.2.2
by Jay Pipes
Forgot to add the new files... |
59 |
{
|
60 |
public: |
|
61 |
/* The type of the hint : USE/FORCE/IGNORE */
|
|
62 |
enum index_hint_type type; |
|
63 |
/* Where the hit applies to. A bitmask of INDEX_HINT_MASK_<place> values */
|
|
64 |
index_clause_map clause; |
|
65 |
/*
|
|
66 |
The index name. Empty (str=NULL) name represents an empty list
|
|
67 |
USE INDEX () clause
|
|
68 |
*/
|
|
2371.1.2
by Brian Aker
Remove the typedef on lexkey |
69 |
lex_string_t key_name; |
934.2.2
by Jay Pipes
Forgot to add the new files... |
70 |
|
71 |
Index_hint (enum index_hint_type type_arg, index_clause_map clause_arg, |
|
72 |
char *str, uint32_t length) : |
|
73 |
type(type_arg), clause(clause_arg) |
|
74 |
{
|
|
75 |
key_name.str= str; |
|
76 |
key_name.length= length; |
|
77 |
}
|
|
78 |
||
79 |
void print(Session *session, String *str); |
|
80 |
};
|
|
81 |
||
1280.1.10
by Monty Taylor
Put everything in drizzled into drizzled namespace. |
82 |
} /* namespace drizzled */ |
83 |