From: Michael Neumann Date: 2004-08-06T19:19:07+09:00 Subject: Re: a bit [OT]: table definition with rubyDBI Ralf M�ller wrote: > Hi, > > I'm very happy with rubyDBI (thanks michael). Especially DBI::Utils::XMLFormatter.table is great. > What i'm looking for is a XMLFormatter for the table definition. > As a first approach : > DBI::Utils::XMLFormatter.table(dbh.select_all("show fields from counter")) > seems ok to me. > But where are the FOREIGN KEY definitions? > How can i get them out of the database without doing "show create table "? > Is there a special DBI command or a special MySQL command? We have the method column_info, but this does not include whether a column is a foreign-key or not (only primary, indexed, nullable etc.). It's probably very database-dependent to get these informations. If you find out how to do this in Mysql (or other DBs), please let me know. I guess in Postgres it would be a simple select to some internal tables. Regards, Michael