DB2::Admin::Constants - Support for DB2 constants from "sqlmon.h" and "sqlutil.h" header files
use DB2::Admin::Constants; # # Lookup information (such as type, value) for a constant # my $info = DB2::Admin::Constants::->GetInfo('SQLM_CURRENT_NODE'); # # Get numerical value for a constant # my $num = DB2::Admin::Constants::->GetValue('SQLM_CURRENT_NODE'); # # Get the symbolic constant name for a category / number # my $name = DB2::Admin::Constants::->Lookup('Platform', 3); # # Lookup information on a database / database manager configuration # parameter. (Use GetDbConfig or GetDbmConfig in DB2::Admin to look # up the actual config params.) # my $info = DB2::Admin::Constants::->GetConfigParam('Name' => 'maxagents', 'Domain' => 'Manager');
This module provides perl language support for the constants from the DB2 sqlmon.h header file. It allows developers to retrieve information based on constant name or value.
sqlmon.h
The information on the constants is stored in the file db2_constants.pl, which is auto-generated by a script that parses the sqlmon.h and sqlutil.h header files. The constants have not been defined as individual perl or C subroutines to avoid bloating the symbol tables and memory usage.
db2_constants.pl
sqlutil.h
The following information is kept for each constant:
This can be Number, String, Character or Expression
Number
String
Character
Expression
The value of the constant
The category is present for some constants and classifies the constant as an Element, Type, Platform, Lock, Heap, Class or Event. If available, the number to constant name lookup is supported using the Lookup method.
Element
Type
Platform
Lock
Heap
Class
Event
Lookup
The comment is a description of the constant as provided in the header file. It is not available for all constants.
This method takes a constant name and returns a hash reference with information available for the constant, or undef if the constant is not known.
undef
This method takes a constant name and returns the numerical value of the constant. If the constant is not known, or if the type of the constant is not a number, it throws an exception.
This method takes two parameters, a category and a number. If returns the constant name that matches both. If the category is not known, it throws an exception. If the category is known but the value is not, it returns undef.
This method takes two named parameters, Name and Domain, that represent a database or database manager configuration parameter. It returns a hash reference with information about the constant, or undef if the configuration parameter name is not know. The return value includes the corresponding constant name, type, domain, optional size, and optional updateable parameter.
Name
Domain
NOTE: This API is subject to change, as we may need to deal with the same config parameter name mapping to a different constant name and size depending on the DB2 release.
The name of a configuration parameter, for example maxagents. THis is looked up in a case-insensitive manner.
maxagents
One of Manager or Database.
Manager
Database
Hildo Biersma
DB2::Admin(3)
To install DB2::Admin, copy and paste the appropriate command in to your terminal.
cpanm
cpanm DB2::Admin
CPAN shell
perl -MCPAN -e shell install DB2::Admin
For more information on module installation, please visit the detailed CPAN module installation guide.