I sent this to the DBI mailing list:
--------------------------------------------------
"I've just gone through the program shown in the O'Reilly DBI on page 149, or, the $dbh->table_info() query.
What that doesn't grab, but I would really like to capture, is the kind of "Type" you get when you give mySQL a DESCRIBE (column) command. In particular, I'd like to be able to capture all the alternatives coded into an ENUM or SET column. Can it be done? Any hints?"
--------------------------------------------------
I got this in response:
--------------------------------------------------
Try the 'LISTFIELDS table_name' query and execute it. That will return no result rows, but the attributes will work.
$sth = $dbh->prepare("LISTFIELDS table_name"
$sth->execute();
while ($sth->fetchrow_array()) {
print $sth->{NAME}." - ".$sth->{TYPE};
}
--------------------------------------------------
Unfortunately, that didn't work for me -- I got no output from the fetchrow_array command.
Does it work for anyone else? Does anyone have another approach for getting detailed TYPE data through DBI? Help help help?
--------------------------------------------------
"I've just gone through the program shown in the O'Reilly DBI on page 149, or, the $dbh->table_info() query.
What that doesn't grab, but I would really like to capture, is the kind of "Type" you get when you give mySQL a DESCRIBE (column) command. In particular, I'd like to be able to capture all the alternatives coded into an ENUM or SET column. Can it be done? Any hints?"
--------------------------------------------------
I got this in response:
--------------------------------------------------
Try the 'LISTFIELDS table_name' query and execute it. That will return no result rows, but the attributes will work.
$sth = $dbh->prepare("LISTFIELDS table_name"
$sth->execute();
while ($sth->fetchrow_array()) {
print $sth->{NAME}." - ".$sth->{TYPE};
}
--------------------------------------------------
Unfortunately, that didn't work for me -- I got no output from the fetchrow_array command.
Does it work for anyone else? Does anyone have another approach for getting detailed TYPE data through DBI? Help help help?