~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/foreign_key.h

  • Committer: Brian Aker
  • Date: 2010-09-11 01:35:47 UTC
  • mto: (1759.2.1 build)
  • mto: This revision was merged to the branch mainline in revision 1762.
  • Revision ID: brian@tangent.org-20100911013547-b04k7f1qddr3ml4t
Shuffle native functions over to hash such that we have a specific container
for them.

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"
29
30
 
30
31
namespace drizzled
31
32
{
35
36
 
36
37
namespace memory { class Root; }
37
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
 
 
49
 
38
50
class Foreign_key: public Key 
39
51
{
40
52
public:
41
 
  enum fk_match_opt 
42
 
  {
43
 
    FK_MATCH_UNDEF, 
44
 
    FK_MATCH_FULL, 
45
 
    FK_MATCH_PARTIAL, 
46
 
    FK_MATCH_SIMPLE
47
 
  };
48
 
  enum fk_option 
49
 
  {
50
 
    FK_OPTION_UNDEF, 
51
 
    FK_OPTION_RESTRICT, 
52
 
    FK_OPTION_CASCADE, 
53
 
    FK_OPTION_SET_NULL, 
54
 
    FK_OPTION_NO_ACTION, 
55
 
    FK_OPTION_DEFAULT
56
 
  };
57
 
 
58
53
  Table_ident *ref_table;
59
54
  List<Key_part_spec> ref_columns;
60
 
  uint32_t delete_opt, update_opt, match_opt;
 
55
 
 
56
  message::Table::ForeignKeyConstraint::ForeignKeyOption delete_opt;
 
57
  message::Table::ForeignKeyConstraint::ForeignKeyOption update_opt;
 
58
  message::Table::ForeignKeyConstraint::ForeignKeyMatchOption match_opt;
 
59
 
61
60
  Foreign_key(const LEX_STRING &name_arg,
62
61
              List<Key_part_spec> &cols,
63
62
              Table_ident *table,
64
63
              List<Key_part_spec> &ref_cols,
65
 
              uint32_t delete_opt_arg,
66
 
              uint32_t update_opt_arg,
67
 
              uint32_t match_opt_arg) :
 
64
              message::Table::ForeignKeyConstraint::ForeignKeyOption delete_opt_arg,
 
65
              message::Table::ForeignKeyConstraint::ForeignKeyOption update_opt_arg,
 
66
              message::Table::ForeignKeyConstraint::ForeignKeyMatchOption match_opt_arg) :
68
67
    Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols), ref_table(table),
69
68
    ref_columns(ref_cols),
70
69
    delete_opt(delete_opt_arg),