DBD::ADO::Const - ADO Constants
use DBD::ADO::Const(); $\ = "\n"; my $Enums = DBD::ADO::Const->Enums; for my $Enum ( sort keys %$Enums ) { print $Enum; for my $Const ( sort keys %{$Enums->{$Enum}} ) { printf " %-35s 0x%X\n", $Const, $Enums->{$Enum}{$Const}; } }
In the OLE type library, many constants are defined as members of enums. 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-documenting.
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 this package return a hash of hashes for exactly this purpose.
Try a XS implementation and benchmark speed-up.
Suggest a more general version (parameterized by $ProgId) for inclusion into Win32::OLE.
Steffen Goeldner (sgoeldner@cpan.org)
Copyright (c) 2002-2003 Steffen Goeldner. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install DBD::ADO, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DBD::ADO
CPAN shell
perl -MCPAN -e shell install DBD::ADO
For more information on module installation, please visit the detailed CPAN module installation guide.