~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/foreign_key.h

  • Committer: Stewart Smith
  • Date: 2010-07-13 01:12:39 UTC
  • mto: (1638.10.46)
  • mto: This revision was merged to the branch mainline in revision 1701.
  • Revision ID: stewart@flamingspork.com-20100713011239-nwgjq3r0oxtaax0w
use the ENUM in the table proto instead of duplicating it for Foreign key options and match option. A move in the direction of just having foreign keys in the proto

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
{
38
39
class Foreign_key: public Key 
39
40
{
40
41
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
42
  Table_ident *ref_table;
59
43
  List<Key_part_spec> ref_columns;
60
 
  uint32_t delete_opt, update_opt, match_opt;
 
44
 
 
45
  message::Table::ForeignKeyConstraint::ForeignKeyOption delete_opt;
 
46
  message::Table::ForeignKeyConstraint::ForeignKeyOption update_opt;
 
47
  message::Table::ForeignKeyConstraint::ForeignKeyMatchOption match_opt;
 
48
 
61
49
  Foreign_key(const LEX_STRING &name_arg,
62
50
              List<Key_part_spec> &cols,
63
51
              Table_ident *table,
64
52
              List<Key_part_spec> &ref_cols,
65
 
              uint32_t delete_opt_arg,
66
 
              uint32_t update_opt_arg,
67
 
              uint32_t match_opt_arg) :
 
53
              message::Table::ForeignKeyConstraint::ForeignKeyOption delete_opt_arg,
 
54
              message::Table::ForeignKeyConstraint::ForeignKeyOption update_opt_arg,
 
55
              message::Table::ForeignKeyConstraint::ForeignKeyMatchOption match_opt_arg) :
68
56
    Key(FOREIGN_KEY, name_arg, &default_key_create_info, 0, cols), ref_table(table),
69
57
    ref_columns(ref_cols),
70
58
    delete_opt(delete_opt_arg),