I am accessing schema information of databases in XML format. I am taking dump of the database in XML format using the command below.
mysqldump --no-data --xml -u root -p bakerydb > bakerydb.xml
these dump don't list the foreign key constraints. Below part of the output is listed.
<table_structure name="class_details">
<field Field="id" Type="int(10)" Null="NO" Key="PRI" Extra="auto_increment" Comment="" />
<field Field="course_id" Type="int(10)" Null="NO" Key="MUL" Extra="" Comment="" />
<field Field="start_date" Type="date" Null="NO" Key="" Extra="" Comment="" />
<field Field="end_date" Type="date" Null="NO" Key="" Extra="" Comment="" />
<field Field="tutor_id" Type="int(10)" Null="NO" Key="MUL" Extra="" Comment="" />
<key Table="class_details" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="id" Collation="A" Cardinality="0" Null="" Index_type="BTREE" Comment="" Index_comment="" />
<key Table="class_details" Non_unique="1" Key_name="fk_cources_offered_class_details" Seq_in_index="1" Column_name="course_id" Collation="A" Cardinality="0" Null="" Index_type="BTREE" Comment="" Index_comment="" />
<key Table="class_details" Non_unique="1" Key_name="fk_employee_details_class_details" Seq_in_index="1" Column_name="tutor_id" Collation="A" Cardinality="0" Null="" Index_type="BTREE" Comment="" Index_comment="" />
<options Name="class_details" Engine="InnoDB" Version="10" Row_format="Compact" Rows="0" Avg_row_length="0" Data_length="16384" Max_data_length="0" Index_length="32768" Data_free="7340032" Auto_increment="1" Create_time="2014-02-25 07:08:56" Collation="utf8_general_ci" Create_options="" Comment="" />
</table_structure>
Same database lists the detailed foreign key constraint in sqldump. (.sql file). below that's mentioned.
DROP TABLE IF EXISTS `class_details`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `class_details` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`course_id` int(10) NOT NULL,
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`tutor_id` int(10) NOT NULL,
PRIMARY KEY (`id`),
KEY `fk_cources_offered_class_details` (`course_id`),
KEY `fk_employee_details_class_details` (`tutor_id`),
CONSTRAINT `fk_employee_details_class_details` FOREIGN KEY (`tutor_id`) REFERENCES `employee_details` (`emp_id`),
CONSTRAINT `fk_courses_offered_class_details` FOREIGN KEY (`course_id`) REFERENCES `courses_offered` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
Anyone know why they don't list parent table information? and the way, How we can get the details of foreign key constraints?
P.S. : storage engine is InnoDB.