On Friday, January 11, 2002, at 07:09 AM, Bart Lateur wrote:
> [beginners list snipped] > > On Fri, 11 Jan 2002 11:40:03 +0100, Marius Keraitis wrote: > >> Second step is to show every table contents (by clicking on link >> with table >> name). >> To do this I need to know how many columns is in table, and all >> names of columns >> in table. > > You can do (very portable): > > my $sth = $dbh->prepare("SELECT * FROM $table"); its a shame that it is not just as portable to limit the result set to 1 row... > $sth->execute; > my @fieldnames = @{$sth->{NAME}}; > $sth->finish; > > Check the contents of @fieldnames. > > Check the other "statement handle attributes" in the DBI docs, such as > "TYPE" and "NULLABLE" (instead of "NAME"), for more interesting > properties. > > -- > Bart. > >