~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/schema_dictionary/foreign_keys.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:
95
95
  return false;
96
96
}
97
97
 
98
 
void ForeignKeysTool::Generator::pushType(message::Table::Field::FieldType type)
99
 
{
100
 
  switch (type)
101
 
  {
102
 
    default:
103
 
      push("VARCHAR");
104
 
      break;
105
 
  }
106
 
}
107
 
 
108
 
std::string ForeignKeysTool::Generator::fkeyOption(message::Table::ForeignKeyConstraint::ForeignKeyOption option)
109
 
{
110
 
  std::string ret;
111
 
  switch (option)
112
 
  {
113
 
    case message::Table::ForeignKeyConstraint::OPTION_UNDEF:
114
 
      ret= "UNDEFINED";
115
 
      break;
116
 
    case message::Table::ForeignKeyConstraint::OPTION_RESTRICT:
117
 
      ret= "RESTRICT";
118
 
      break;
119
 
    case message::Table::ForeignKeyConstraint::OPTION_CASCADE:
120
 
      ret= "CASCADE";
121
 
      break;
122
 
    case message::Table::ForeignKeyConstraint::OPTION_SET_NULL:
123
 
      ret= "SET NULL";
124
 
      break;
125
 
    case message::Table::ForeignKeyConstraint::OPTION_NO_ACTION:
126
 
      ret= "NO ACTION";
127
 
      break;
128
 
    case message::Table::ForeignKeyConstraint::OPTION_DEFAULT:
129
 
    default:
130
 
      ret= "DEFAULT";
131
 
      break;
132
 
  }
133
 
  return ret;
134
 
}
135
 
 
136
98
void ForeignKeysTool::Generator::fill()
137
99
{
138
100
  /* CONSTRAINT_SCHEMA */
176
138
  push(destination);
177
139
 
178
140
  /* MATCH_OPTION */
179
 
  switch (fkey.match())
180
 
  {
181
 
    case message::Table::ForeignKeyConstraint::MATCH_FULL:
182
 
      push("FULL");
183
 
      break;
184
 
    case message::Table::ForeignKeyConstraint::MATCH_PARTIAL:
185
 
      push("PARTIAL");
186
 
      break;
187
 
    case message::Table::ForeignKeyConstraint::MATCH_SIMPLE:
188
 
      push("SIMPLE");
189
 
      break;
190
 
    default:
191
 
      push("NONE");
192
 
      break;
193
 
  }
 
141
  push(drizzled::message::type(fkey.match()));
 
142
 
194
143
  /* UPDATE_RULE */
195
 
  push(fkeyOption(fkey.update_option()));
 
144
  push(drizzled::message::type(fkey.update_option()));
196
145
 
197
146
  /* DELETE_RULE */
198
 
  push(fkeyOption(fkey.delete_option()));
 
147
  push(drizzled::message::type(fkey.delete_option()));
199
148
 
200
149
}