~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to client/drizzledump_data.cc

  • Committer: Andrew Hutchings
  • Date: 2010-10-12 15:43:24 UTC
  • mto: (1856.1.3 build)
  • mto: This revision was merged to the branch mainline in revision 1857.
  • Revision ID: andrew@linuxjedi.co.uk-20101012154324-mf9lnvixb4lay5ut
Add foreign keys to Drizzle server

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
 
80
80
}
81
81
 
 
82
std::ostream& operator <<(std::ostream &os, const DrizzleDumpForeignKey &obj)
 
83
{
 
84
  os << "  CONSTRAINT `" << obj.constraintName << "` FOREIGN KEY ("
 
85
    << obj.parentColumns << ") REFERENCES `" << obj.childTable << "` ("
 
86
    << obj.childColumns << ")";
 
87
 
 
88
  if (not obj.deleteRule.empty())
 
89
    os << " ON DELETE " << obj.deleteRule;
 
90
 
 
91
  if (not obj.updateRule.empty())
 
92
    os << " ON UPDATE " << obj.updateRule;
 
93
 
 
94
  return os;
 
95
}
 
96
 
82
97
std::ostream& operator <<(std::ostream &os, const DrizzleDumpIndex &obj)
83
98
{
84
99
  if (obj.isPrimary)
410
425
  std::vector<DrizzleDumpIndex*> output_indexes = obj.indexes;
411
426
  for (j= output_indexes.begin(); j != output_indexes.end(); ++j)
412
427
  {
413
 
    os << "," << std::endl;;
 
428
    os << "," << std::endl;
414
429
    DrizzleDumpIndex *index= *j;
415
430
    os << *index;
416
431
  }
 
432
 
 
433
  std::vector<DrizzleDumpForeignKey*>::iterator k;
 
434
  std::vector<DrizzleDumpForeignKey*> output_fkeys = obj.fkeys;
 
435
  for (k= output_fkeys.begin(); k != output_fkeys.end(); ++k)
 
436
  {
 
437
    os << "," << std::endl;
 
438
    DrizzleDumpForeignKey *fkey= *k;
 
439
    os << *fkey;
 
440
  }
 
441
 
417
442
  os << std::endl;
418
443
  os << ") ENGINE=" << obj.engineName << " ";
419
444
  if (obj.autoIncrement > 0)