Similar to this question but for MySQL....
How can I programmatically determine foreign key references in MySQL (assuming InnoDB)? I can almost get them with:
SHOW TABLE STATUS WHERE Name = 'MyTableName';
...but alas, the comment column which seems to contain some of this info gets truncated so I can't rely on it. There must be some other way...
I'd be happy with a C API call, a SQL statement, anything--I just need something that consistently works.
Note: I've also considered parsing the results of a "SHOW CREATE TABLE MyTableName" statement, but I'm really hoping there's something simpler.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…