Local::DBI::ADO::TypeInfo - ADO TypeInfo

I'd like to include this with DBD::ADO, except using the package name
DBD::ADO::TypeInfo. This is excellent work and does increase the self
documenting code and clarity. OK?

Steffen, THANK YOU for all your contributions!

Tom

On Fri, Nov 23, 2001 at 10:22:14AM +0100, Steffen Goeldner wrote:

> No, I didn't give up! I'm still playing with OpenSchema() and
> investigate the results. Thereby, I encountered some difficulties
> with the DBD::ADO constants ($ado_consts) - more precisely: how
> they are stored.
> It's easy to lookup DBD::ADO constants by name, e.g.:
> 
>   $ado_consts->{adChar} == 129
> 
> Unfortunately, Win32::OLE::Const does not preserve the namespace
> of the enums. It's a matter of taste, but I think
> 
>   $ado_consts->{DataTypeEnum}{adChar} == 129
> 
> makes the code more self-documented. Furthermore, many DBD::ADO
> methods return numeric codes. Transforming these codes into human
> readable strings requires an inverse lookup by value. Building the
> reverse hash for e.g. all datatypes requires that datatype constants
> can be distinguished from other constants, i.e. we need the namespace
> preserved.
> The Enums() method of the attached package returns a hash of hashes
> for exactly this purpose. Now you can do:
> 
>   my $Enums = Local::DBI::ADO::TypeInfo->Enums;
>   my %Types = reverse %{$Enums->{DataTypeEnum}};
> 
>   my $sth = $dbh->func('adSchemaColumns', @Criteria, 'OpenSchema');
>   while ( my $Row = $sth->fetch ) {
>     ...
>     print $Row->[11] , ' is ', $Types{$Row->[11]};  # DATA_TYPE
>     ...
>   }

-- 
Thomas A. Lowery
See DBI/FAQ http://tlowery.hypermart.net

_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com

Reply via email to