1
1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems, Inc.
4
* Copyright (C) 2008 Sun Microsystems
6
6
* This program is free software; you can redistribute it and/or modify
7
7
* it under the terms of the GNU General Public License as published by
21
21
#ifndef DRIZZLED_FOREIGN_KEY_H
22
22
#define DRIZZLED_FOREIGN_KEY_H
24
#include "drizzled/memory/sql_alloc.h"
25
#include "drizzled/key.h"
26
#include "drizzled/key_part_spec.h"
27
#include "drizzled/sql_list.h"
28
#include "drizzled/cursor.h" /* for default_key_create_info */
29
#include "drizzled/message/table.pb.h"
24
#include <drizzled/sql_alloc.h>
25
#include <drizzled/key.h>
26
#include <drizzled/sql_list.h>
37
namespace memory { class Root; }
39
void add_foreign_key_to_table_message(
40
message::Table *table_message,
41
const char* fkey_name,
42
List<Key_part_spec> &cols,
44
List<Key_part_spec> &ref_cols,
45
message::Table::ForeignKeyConstraint::ForeignKeyOption delete_opt_arg,
46
message::Table::ForeignKeyConstraint::ForeignKeyOption update_opt_arg,
47
message::Table::ForeignKeyConstraint::ForeignKeyMatchOption match_opt_arg);
50
class Foreign_key: public Key
31
typedef struct st_mem_root MEM_ROOT;
33
class Foreign_key: public Key {
53
52
Table_ident *ref_table;
54
53
List<Key_part_spec> ref_columns;
56
message::Table::ForeignKeyConstraint::ForeignKeyOption delete_opt;
57
message::Table::ForeignKeyConstraint::ForeignKeyOption update_opt;
58
message::Table::ForeignKeyConstraint::ForeignKeyMatchOption match_opt;
54
uint32_t delete_opt, update_opt, match_opt;
60
55
Foreign_key(const LEX_STRING &name_arg,
61
56
List<Key_part_spec> &cols,
62
57
Table_ident *table,
63
58
List<Key_part_spec> &ref_cols,
64
message::Table::ForeignKeyConstraint::ForeignKeyOption delete_opt_arg,
65
message::Table::ForeignKeyConstraint::ForeignKeyOption update_opt_arg,
66
message::Table::ForeignKeyConstraint::ForeignKeyMatchOption match_opt_arg) :
59
uint32_t delete_opt_arg,
60
uint32_t update_opt_arg,
61
uint32_t match_opt_arg) :
67
62
Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols), ref_table(table),
68
63
ref_columns(ref_cols),
69
64
delete_opt(delete_opt_arg),