Two minor notes:
First, you might want to be careful about the values returned by $sth->{NAME} if you care about case-sensitivity. The DBI doesn't make them consistent or modify them at all -- they're whatever the database returns. And what the database returns can be vendor specific. The NAME_uc and NAME_lc properties do what you'd expect.
Second, I think the integer values returned from $sth->{TYPE} correspond to the DBI SQL type constants. So you can do:
use DBI qw( :sql_types ); ... my $types = $sth->{TYPE}; foreach my $type ( @{ $types } ) { print "VARCHAR" if ( $type == SQL_VARCHAR ); print "DATETIME" if ( $type == SQL_DATETIME ); print "BOOLEAN" if ( $type == SQL_BIT ); print "FLOAT" if ( $type == SQL_FLOAT ); ... }
Conveniently, most of them also map to the ODBC CLI specifications. :-)
You can find the type-to-constant mapping in the 'dbi_sql.h' header file found in your architecture-dependent perl library tree -- for example, mine is in site_perl/5.6.1/i686-linux/auto/DBI/dbi_sql.h
Chris
M-x auto-bs-mode
In reply to Re: Re: How do you get Perl::DBI to do a desc table_name?
by lachoy
in thread How do you get Perl::DBI to do a desc table_name?
by kleinbiker7
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |