584.1.15
by Monty Taylor
The mega-patch from hell. Renamed sql_class to session (since that's what it is) and removed it and field and table from common_includes. |
1 |
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
|
2 |
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
|
|
3 |
*
|
|
4 |
* Copyright (C) 2008 Sun Microsystems
|
|
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; version 2 of the License.
|
|
9 |
*
|
|
10 |
* This program is distributed in the hope that it will be useful,
|
|
11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
13 |
* GNU General Public License for more details.
|
|
14 |
*
|
|
15 |
* You should have received a copy of the GNU General Public License
|
|
16 |
* along with this program; if not, write to the Free Software
|
|
17 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
18 |
*/
|
|
19 |
||
20 |
||
21 |
#ifndef DRIZZLED_KEY_H
|
|
22 |
#define DRIZZLED_KEY_H
|
|
23 |
||
24 |
||
25 |
#include <drizzled/sql_alloc.h> |
|
26 |
#include <drizzled/key_part_spec.h> |
|
27 |
#include <drizzled/sql_list.h> |
|
28 |
#include <drizzled/lex_string.h> |
|
29 |
#include <drizzled/handler_structs.h> |
|
30 |
||
31 |
class Item; |
|
32 |
typedef struct st_mem_root MEM_ROOT; |
|
33 |
||
34 |
class Key :public Sql_alloc { |
|
35 |
public: |
|
36 |
enum Keytype { PRIMARY, UNIQUE, MULTIPLE, FOREIGN_KEY}; |
|
37 |
enum Keytype type; |
|
38 |
KEY_CREATE_INFO key_create_info; |
|
39 |
List<Key_part_spec> columns; |
|
40 |
LEX_STRING name; |
|
41 |
bool generated; |
|
42 |
||
43 |
Key(enum Keytype type_par, const LEX_STRING &name_arg, |
|
44 |
KEY_CREATE_INFO *key_info_arg, |
|
45 |
bool generated_arg, List<Key_part_spec> &cols) |
|
46 |
:type(type_par), key_create_info(*key_info_arg), columns(cols), |
|
47 |
name(name_arg), generated(generated_arg) |
|
48 |
{}
|
|
49 |
Key(enum Keytype type_par, const char *name_arg, size_t name_len_arg, |
|
50 |
KEY_CREATE_INFO *key_info_arg, bool generated_arg, |
|
51 |
List<Key_part_spec> &cols) |
|
52 |
:type(type_par), key_create_info(*key_info_arg), columns(cols), |
|
53 |
generated(generated_arg) |
|
54 |
{
|
|
55 |
name.str= (char *)name_arg; |
|
56 |
name.length= name_len_arg; |
|
57 |
}
|
|
58 |
Key(const Key &rhs, MEM_ROOT *mem_root); |
|
59 |
virtual ~Key() {} |
|
60 |
/* Equality comparison of keys (ignoring name) */
|
|
61 |
friend bool foreign_key_prefix(Key *a, Key *b); |
|
62 |
/**
|
|
63 |
Used to make a clone of this object for ALTER/CREATE TABLE
|
|
64 |
@sa comment for Key_part_spec::clone
|
|
65 |
*/
|
|
66 |
virtual Key *clone(MEM_ROOT *mem_root) const |
|
67 |
{ return new (mem_root) Key(*this, mem_root); } |
|
68 |
};
|
|
69 |
||
70 |
#endif /* DRIZZLED_KEY_H */ |