CREATE TABLE foo(
id int(10) unsigned NOT NULL AUTO_INCREMENT,
letter char(1) NOT NULL,
name text NOT NULL,
num float NULL,
PRIMARY KEY (id)
);
####
#!/usr/local/bin/perl -w
use DBI;
my $dbh = DBI->connect('dbi:mysql:test', "", "", { PrintError => 0 , RaiseError => 1});
END { $dbh->disconnect if $dbh }
use Data::Dumper;
my $sth = $dbh->prepare('DESCRIBE foo');
$sth->execute;
while(my $r = $sth->fetchrow_hashref) {
print Dumper $r;
}
####
$VAR1 = {
'Extra' => 'auto_increment',
'Field' => 'id',
'Default' => undef,
'Key' => 'PRI',
'Type' => 'int(10) unsigned',
'Null' => ''
};
$VAR1 = {
'Extra' => '',
'Field' => 'letter',
'Default' => '',
'Key' => '',
'Type' => 'char(1)',
'Null' => ''
};
$VAR1 = {
'Extra' => '',
'Field' => 'name',
'Default' => '',
'Key' => '',
'Type' => 'text',
'Null' => ''
};
$VAR1 = {
'Extra' => '',
'Field' => 'num',
'Default' => undef,
'Key' => '',
'Type' => 'float',
'Null' => 'YES'
};