Getting MySQL column comment metadata?

M

Mario T. Lanza

Hi All,

How do I go about getting the "Comments" metadata--the one I type via
MySQL Administrator, for example--associated with a MySQL column?

I have been able to pull metadata from both ActiveRecord and DBI but
cannot seem to find this added bit of info.

Thanks.
Mario T. Lanza
 
M

Michael Steinfeld

I'm not sure what you are asking, so I will take a guess...

If you want to access the metadata on all tables in db "MY_DB" you can
do something like..

SELECT table_name, table_type, engine FROM INFORMATION_SCHEMA.tables
WHERE table_schema = 'MY_DB' ORDER BY table_type ASC, table_name DESC;

Or you can just use "describe table_name;" to get data on that specific table.

-mike
 
K

Ken Bloom

Hi All,

How do I go about getting the "Comments" metadata--the one I type via
MySQL Administrator, for example--associated with a MySQL column?

I have been able to pull metadata from both ActiveRecord and DBI but
cannot seem to find this added bit of info.

This doesn't appear to be implemented directily in MySQL's C API.
Certainly it's not implemented in the direct MySQL Ruby API (see http://
www.tmtm.org/en/mysql/ruby/ and have a look at fetch_fields and the
Mysql::Field class). Since DBD::Myql uses fetch_fields to determine what
metadata is available, it's not available in dbi. I don't know about
ActiveRecord, but I would expect the same thing.

The only way I know of to get this information is by running a "show full
columns from TABLENAME" or using INFORMATION_SCHEMA. (Well, there's "show
create table" too, but that requires parsing -- why use that when you
have "show full columns")

--Ken
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,264
Messages
2,571,315
Members
48,000
Latest member
SusannahSt

Latest Threads

Top