DB2 Version 10.1 for Linux, UNIX, and Windows

db2DbDirOpenScan API - Start a system or local database directory scan

Stores a copy of the system database directory or the local database directory in memory, and returns the number of entries. This copy represents a snapshot of the directory at the time the directory is opened. This copy is not updated, even if the directory itself is changed later.

Use the db2DbDirGetNextEntry API to advance through the database directory, examining information about the database entries. Close the scan using the db2DbDirCloseScan API. This removes the copy of the directory from memory.

Authorization

None

Required connection

None

API include file

db2ApiDf.h

API and data structure syntax

SQL_API_RC SQL_API_FN
  db2DbDirOpenScan (
       db2Uint32 versionNumber,
       void * pParmStruct,
       struct sqlca * pSqlca);

typedef SQL_STRUCTURE db2DbDirOpenScanStruct
{
   char *piPath;
   db2Uint16 oHandle;
   db2Uint16 oNumEntries;
} db2DbDirOpenScanStruct;

SQL_API_RC SQL_API_FN
  db2gDbDirOpenScan (
       db2Uint32 versionNumber,
       void * pParmStruct,
       struct sqlca * pSqlca);

typedef SQL_STRUCTURE db2gDbDirOpenScanStruct
{
   db2Uint32 iPath_len;
   char *piPath;
   db2Uint16 oHandle;
   db2Uint16 oNumEntries;
} db2gDbDirOpenScanStruct;

db2DbDirOpenScan API parameters

versionNumber
Input. Specifies the version and release level of the structure passed in as the second parameter, pParmStruct.
pParmStruct
Input. A pointer to the db2DbDirOpenScanStruct structure.
pSqlca
Output. A pointer to the sqlca structure.

db2DbDirOpenScanStruct data structure parameters

piPath
Input. The name of the path on which the local database directory resides. If the specified path is a NULL pointer, the system database directory is used.
oHandle
Output. A 2-byte area for the returned identifier. This identifier must be passed to the db2DbDirGetNextEntry API for scanning the database entries, and to the db2DbDirCloseScan API to release the resources.
oNumEntries
Output. A 2-byte area where the number of directory entries is returned.

db2gDbDirOpenScanStruct data structure specific parameters

iPath_len
Input. The length in bytes of the piPath parameter.

Usage notes

Storage allocated by this API is freed by the db2DbDirCloseScan API.

Multiple db2DbDirOpenScan APIs can be issued against the same directory. However, the results may not be the same. The directory may change between openings.

There can be a maximum of eight opened database directory scans per process.