NCP::DBI_Factory module overview

The NCP::DBI_Factory module provides an interface to make it easier to use the standard Perl DBI module to perform operations on the NCIM topology database. Use of this module assumes that you understand the standard Perl DBI module. The NCP::DBI_Factory module reads the database login details from DbLogins.DOMAIN.cfg, which allows it access to the pre-configured data sources such as NCIM.

DBI handle

The NCP::DBI_Factory module provides a method that creates and initializes a new DBI handle. You pass this handle in subsequent calls to the methods that perform operations on the specified NCIM topology database. This DBI handle contains the information needed to connect to the requested NCIM topology database.

Databases that the DBI_Factory module supports

The NCP::DBI_Factory module currently supports operations on the following databases:

  • Db2®
  • Oracle

For all of these databases, table and field names are case-insensitive from the point of view of SQL statements. However, rows returned by both the Db2 and Oracle databases will have all field names in upper case. The NCP::DBI_Factory module provides the toUpper method that returns a copy of a single row with all lower case field names in upper case.

NCIM Database operation methods

The NCP::DBI_Factory module provides methods that client/server applications use to perform a variety of operations on the specified NCIM topology database.

The following table identifies and briefly describes the database operation methods that the NCP::DBI_Factory module provides:

NCIM Database method Description

createDbHandle

Creates a standard DBI handle to be used in subsequent calls to the other NCP::DBI_Factory methods.

describeTable

Returns a sorted array of upper case field names for the specified table or view.

extractCmdLineOptions

Allows database login options for the DBI handles to be provided in a common format.

extractHashRefOptions

Extracts database login options from a reference to a hash.

insert_auto_inc_row

Inserts a row into a named table, where the table has an auto incremented column.

insert_row

Inserts a row into a named table.

schema

Returns the schema name associated with the NCIM topology database being used.

setLogHandle

Passes in a log handle associated with an opened file used for logging messages.

setLogLevel

Sets the log level for error and message reporting.

tables

Returns a sorted array of table and view names for the current schema.

timeStamp

Returns the current timestamp in a format suitable for addition to the NCIM topology database.

toUpper

Returns a copy of a hash (a single row retrieved from an NCIM database table ) with all field names converted to upper case.

See NCP::DBI_Factory module reference for the reference (man) pages associated with these methods.