The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

DB2::Admin::Constants - Support for DB2 constants from "sqlmon.h" and "sqlutil.h" header files

SYNOPSIS

  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');

DESCRIPTION

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.

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.

The following information is kept for each constant:

Type

This can be Number, String, Character or Expression

Value

The value of the constant

Category

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.

Comment

The comment is a description of the constant as provided in the header file. It is not available for all constants.

METHODS

GetInfo

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.

GetValue

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.

Lookup

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.

GetConfigParam

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.

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.

Name

The name of a configuration parameter, for example maxagents. THis is looked up in a case-insensitive manner.

Domain

One of Manager or Database.

AUTHOR

Hildo Biersma

SEE ALSO

DB2::Admin(3)