sub getTableStructure { # need: $dbh # tablename # returns: hash of field(column) records my ($dbh, $tablename) = @_; my %struct_hash; my $SQL = "SHOW COLUMNS FROM $tablename"; my $sth = $dbh->prepare( $SQL ); $sth->execute(); while ( my $inphash = $sth->fetchrow_hashref() ) { $struct_hash{$inphash->{Field}} = $inphash->{Type}; } return %struct_hash; }