~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/foreign_key.h

  • Committer: Lee Bieber
  • Date: 2010-01-30 23:42:02 UTC
  • mto: This revision was merged to the branch mainline in revision 1282.
  • Revision ID: lbieber@lee-biebers-macbook-pro.local-20100130234202-sxmqfteqwiq15ptg
add target to japanese tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
#include "drizzled/key_part_spec.h"
27
27
#include "drizzled/sql_list.h"
28
28
#include "drizzled/cursor.h" /* for default_key_create_info */
29
 
#include "drizzled/message/table.pb.h"
30
 
 
31
 
namespace drizzled
32
 
{
33
29
 
34
30
class Item;
35
31
class Table_ident;
36
32
 
37
 
namespace memory { class Root; }
38
 
 
39
 
void add_foreign_key_to_table_message(
40
 
    message::Table *table_message,
41
 
    const char* fkey_name,
42
 
    List<Key_part_spec> &cols,
43
 
    Table_ident *table,
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);
48
 
 
 
33
namespace drizzled { namespace memory { class Root; } }
49
34
 
50
35
class Foreign_key: public Key 
51
36
{
52
37
public:
 
38
  enum fk_match_opt 
 
39
  {
 
40
    FK_MATCH_UNDEF, 
 
41
    FK_MATCH_FULL, 
 
42
    FK_MATCH_PARTIAL, 
 
43
    FK_MATCH_SIMPLE
 
44
  };
 
45
  enum fk_option 
 
46
  {
 
47
    FK_OPTION_UNDEF, 
 
48
    FK_OPTION_RESTRICT, 
 
49
    FK_OPTION_CASCADE, 
 
50
    FK_OPTION_SET_NULL, 
 
51
    FK_OPTION_NO_ACTION, 
 
52
    FK_OPTION_DEFAULT
 
53
  };
 
54
 
53
55
  Table_ident *ref_table;
54
56
  List<Key_part_spec> ref_columns;
55
 
 
56
 
  message::Table::ForeignKeyConstraint::ForeignKeyOption delete_opt;
57
 
  message::Table::ForeignKeyConstraint::ForeignKeyOption update_opt;
58
 
  message::Table::ForeignKeyConstraint::ForeignKeyMatchOption match_opt;
59
 
 
 
57
  uint32_t delete_opt, update_opt, match_opt;
60
58
  Foreign_key(const LEX_STRING &name_arg,
61
59
              List<Key_part_spec> &cols,
62
60
              Table_ident *table,
63
61
              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) :
 
62
              uint32_t delete_opt_arg,
 
63
              uint32_t update_opt_arg,
 
64
              uint32_t match_opt_arg) :
67
65
    Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols), ref_table(table),
68
66
    ref_columns(ref_cols),
69
67
    delete_opt(delete_opt_arg),
78
76
   * If out of memory, a partial copy is returned and an error is set
79
77
   * in Session.
80
78
   */
81
 
  Foreign_key(const Foreign_key &rhs, memory::Root *mem_root);
 
79
  Foreign_key(const Foreign_key &rhs, drizzled::memory::Root *mem_root);
82
80
 
83
81
 
84
82
  /**
86
84
   * 
87
85
   * @see comment for Key_part_spec::clone
88
86
   */
89
 
  virtual Key *clone(memory::Root *mem_root) const
 
87
  virtual Key *clone(drizzled::memory::Root *mem_root) const
90
88
  {
91
89
    return new (mem_root) Foreign_key(*this, mem_root);
92
90
  }
96
94
  bool validate(List<CreateField> &table_fields);
97
95
};
98
96
 
99
 
} /* namespace drizzled */
100
 
 
101
97
#endif /* DRIZZLED_FOREIGN_KEY_H */