Beheerder |
|
Citaat: Posted by Steven Szelei on June 28 2004 5:54pm [Delete] [Edit]
I was looking for a way to show the relationship of tables based on unique key, key, index, and foreign key constraints. I found that I can get some of the data using the admin statement SHOW INDEX FROM <<TBL>>. However this will give only the index name and the Column_name in the table that I am requesting from. I then did a SHOW CREATE TABLE <<TBL>> and this dumps the DDL script used to create the table. I would have to parse this information but could get everything I needed. I then found that SHOW TABLE STATUS LIKE <<TBL>> gave me The REFER information mapped to the column name. Unfortunatlly it did so in the Comments field as a string so uh! more parsing. This is what I have been able to discover so far and am still looking for a clean way to gather key, index, and constraint information to dynamically build table relationships. Also I noticed that the constraint names set in the DDL have not been preserved and mysql has given the constraints their own names. Names given keys are preserved. you can see this by running the show create table <<TBL>> on any table you have set constraints on. |