in reply to field lengths of database tables
A quick and dirty way get table information is send the describe MySQL command. It doesn't port well to other databases but gives you most of the information in one query.
In Section
Seekers of Perl Wisdom