~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/information_schema_dictionary/referential_constraints.cc

  • Committer: Brian Aker
  • Date: 2010-10-27 23:24:30 UTC
  • mfrom: (1861.4.9 trunk-drizzle)
  • Revision ID: brian@tangent.org-20101027232430-e9ces9kmhvknr86c
Merge in additions to IS for FK

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
  add_field("DELETE_RULE");
39
39
}
40
40
 
41
 
void ReferentialConstraints::Generator::fill()
42
 
{
43
 
}
44
 
 
45
 
bool ReferentialConstraints::Generator::nextCore()
46
 
{
47
 
  return false;
48
 
}
49
 
 
50
 
bool ReferentialConstraints::Generator::next()
51
 
{
52
 
  while (not nextCore())
53
 
  {
54
 
    return false;
55
 
  }
56
 
 
57
 
  return true;
58
 
}
59
 
 
60
41
ReferentialConstraints::Generator::Generator(drizzled::Field **arg) :
61
42
  InformationSchema::Generator(arg),
62
 
  is_primed(false)
 
43
  foreign_key_generator(getSession())
63
44
{
64
45
}
65
46
 
66
47
bool ReferentialConstraints::Generator::populate()
67
48
{
68
 
  if (not next())
69
 
    return false;
70
 
 
71
 
  fill();
72
 
 
73
 
  return true;
 
49
  drizzled::generator::FieldPair field_pair;
 
50
  while (!!(field_pair= foreign_key_generator))
 
51
  {
 
52
    const drizzled::message::Table *table_message= field_pair.first;
 
53
    const message::Table::ForeignKeyConstraint &foreign_key(table_message->fk_constraint(field_pair.second));
 
54
 
 
55
    // CONSTRAINT_CATALOG
 
56
    push(table_message->catalog());
 
57
 
 
58
    // CONSTRAINT_SCHEMA
 
59
    push(table_message->schema());
 
60
 
 
61
    // CONSTRAINT_NAME
 
62
    push(foreign_key.name());
 
63
 
 
64
    // UNIQUE_CONSTRAINT_CATALOG
 
65
    push(table_message->catalog());
 
66
    
 
67
    // UNIQUE_CONSTRAINT_SCHEMA
 
68
    push(table_message->schema());
 
69
 
 
70
    // UNIQUE_CONSTRAINT_NAME
 
71
    push(" ");
 
72
    
 
73
    // MATCH_OPTION 
 
74
    push(drizzled::message::type(foreign_key.match()));
 
75
    
 
76
    //UPDATE_RULE
 
77
    push(drizzled::message::type(foreign_key.update_option()));
 
78
 
 
79
    //DELETE_RULE
 
80
    push(drizzled::message::type(foreign_key.delete_option()));
 
81
 
 
82
    return true;
 
83
  }
 
84
 
 
85
  return false;
74
86
}