xflminterface IF_DbInfo : public XF_RefCount
This is the database information object. It is returned from the IF_DbSystem::dbCheck method. It contains all of the statistical information collected by dbCheck. Its methods allow an application to access that information.
Method Summary |
|
FLMUINT |
getNumCollections - Returns the number of collections found in the database. |
FLMUINT |
getNumIndexes - Returns the number of indexes found in the database. |
FLMUINT |
getNumLogicalFiles - Returns the number of collections + indexes found in the database. |
FLMUINT64 |
getFileSize - Returns the total size of all of the files that make up the database. |
XFLM_DB_HDR * |
getDbHdr - Returns a pointer to the database header structure. |
void |
getAvailBlockStats - Returns statistics on available blocks in the database. |
void |
getLFHBlockStats - Returns statistics on LFH (logical file header) blocks in the database. |
void |
getBTreeInfo - Returns information about a particular logical file b-tree in the database. |
Method Detail |
FLMUINT getNumCollections( void);
Returns the number of collections that the IF_DbSystem::dbCheck method found in the database.
Parameters In: none
Parameters Out: none
Example Code:
IF_DbInfo * pDbInfo = NULL;
RCODE rc;
FLMUINT uiNumCollections;
FLMUINT uiNumIndexes;
FLMUINT uiNumLogicalFiles;
FLMUINT64 ui64TotalDatabaseSize;
XFLM_DB_HDR * pDbHdr;
FLMUINT64 ui64KeyCount;
FLMUINT64 ui64BytesUsed;FLMUINT64 ui64ElementCount;
FLMUINT64 ui64ContElementCount;
FLMUINT64 ui64ContElmBytes;
FLMUINT uiBlockCount;FLMINT iLastError;
FLMUINT uiNumErrors;
FLMUINT uiLfNum;
eLFileType eLfType;
FLMUINT uiRootBlkAddress;
FLMUINT uiNumLevels;
FLMUINT uiLoop;
FLMUINT uiLevel;
// Check database - gather statistics into pDbInfo.
if (RC_BAD( rc = pDbSystem->dbCheck( "xml.db", NULL, NULL, 0, &pDbInfo, NULL, NULL)))
{
goto Exit;
}uiNumCollections = pDbInfo->getNumCollections();
uiNumIndexes = pDbInfo->getNumIndexes();
uiNumLogicalFiles = pDbInfo->getNumLogicalFiles();
ui64TotalDatabaseSize = pDbInfo->getFileSize();
pDbHdr = pDbInfo->getDbHdr();
printf(....); // Print out statistics from the above information
// Get statistics on available blocks and print them out
pDbInfo->getAvailBlockStats( &ui64BytesUsed, &uiBlockCount, &iLastError, &uiNumErrors);
printf(.....); // Print the available block statistics
// Get statistics on LFH blocks and print them out
pDbInfo->getLFHBlockStats( &ui64BytesUsed, &uiBlockCount, &iLastError, &uiNumErrors);
printf(.....); // Print the LFH block statistics
for (uiLoop = 0; uiLoop < uiNumLogicalFiles; uiLoop++)
{
pDbInfo->getBTreeInfo( uiLoop, &uiLfNum, &eLfType, &uiRootBlkAddress, &uiNumLevels);
printf(.....); // Print info. about the logical file
// Print information about each level in the b-tree
for (uiLevel= 0; uiLevel< uiNumLevels; uiLevel++)
{
pDbInfo->getBTreeBlockStats( uiLoop, uiLevel, &iu64KeyCount,
&ui64BytesUsed, &ui64ElementCount, &ui64ContElementCount,
&ui64ContElmBytes, &uiBlockCount, &iLastError, &uiNumErrors);
printf(.....); // Print info. about this level in the b-tree
}
}
See Also:
FLMUINT getNumIndexes( void);
Returns the number of indexes that the IF_DbSystem::dbCheck method found in the database.
Parameters In: none
Parameters Out: none
Example Code: see getNumCollections.
See Also:
FLMUINT getNumLogicalFiles( void);
Returns the number of collections + indexes that the IF_DbSystem::dbCheck method found in the database.
Parameters In: none
Parameters Out: none
Example Code: see getNumCollections.
See Also:
FLMUINT64 getFileSize( void);
Returns the total size of all of the files that make up the database checked by IF_DbSystem::dbCheck.
Parameters In: none
Parameters Out: none
Example Code: see getNumCollections.
See Also:
XFLM_DB_HDR * getDbHdr( void);
Returns a pointer to an XFLM_DB_HDR structure which contains all of the information in the database's header. NOTE: This pointer points directly at data contained inside the IF_DbInfo object. Hence, it is only good for as long as the object is not freed.
Parameters In: none
Parameters Out: none
Example Code: see getNumCollections.
See Also:
void getAvailBlockStats(
FLMUINT64 * pui64BytesUsed,
FLMUINT * puiBlockCount,
FLMINT * piLastError,
FLMUINT * puiNumErrors);
Returns statistics collected on available blocks in the database.
Parameters In: none
Parameters Out:
FLMUINT64 * pui64BytesUsed Returns total bytes used in available blocks. FLMUINT * puiBlockCount Returns the number of available blocks. FLMINT * piLasterror Returns the last corruption error code, if any, reported for available blocks.
FLMUINT * puiNumErrors Returns the number of corruptions found in available blocks.
Example Code: see getNumCollections.
See Also:
void getLFHBlockStats(
FLMUINT64 * pui64BytesUsed,
FLMUINT * puiBlockCount,
FLMINT * piLastError,
FLMUINT * puiNumErrors);
Returns statistics collected on LFH (logical file header) blocks in the database.
Parameters In: none
Parameters Out:
FLMUINT64 * pui64BytesUsed Returns total bytes used in LFH blocks. FLMUINT * puiBlockCount Returns the number of LFH blocks. FLMINT * piLastError Returns the last corruption error code, if any, reported for LFH blocks.
FLMUINT * puiNumErrors Returns the number of corruptions found in LFH blocks.
Example Code: see getNumCollections.
See Also:
void getBTreeInfo(
FLMUINT uiNthLogicalFile,
FLMUINT * puiLfNum
eLFileType * peLfType,
FLMUINT * puiRootBlkAddress,
FLMUINT * puiNumLevels);
Returns information about the nth logical file B-tree for which information was collected.
Parameters In:
FLMUINT uiNthLogicalFile Specifies which logical file we want information on. It is a zero based number. If getNumLogicalFiles returns N as the number of logical files, this must be a number between 0 and N-1.
Parameters Out:
FLMUINT * puiLfNum Logical file number. eLFileType * peLfType Type of logical file: XFLM_LF_COLLECTION or XFLM_LF_INDEX. FLMUINT * puiRootBlkAddress Address of root block for this logical file's b-tree.
FLMUINT * puiNumLevels Number of levels in this logical file's b-tree.
Example Code: see getNumCollections.
See Also:
void getBTreeBlockStats(
FLMUINT uiNthLogicalFile,
FLMUINT uiLevel,
FLMUINT64 * pui64KeyCount,
FLMUINT64 * pui64BytesUsed,
FLMUINT64 * pui64ElementCount,
FLMUINT64 * pui64ContElementCount,
FLMUINT64 * pui64ContElmBytes,
FLMUINT * puiBlockCount,
FLMINT * piLastError,
FLMUINT * puiNumErrors);
Returns information about the nth logical file B-tree for which information was collected.
Parameters In:
FLMUINT uiNthLogicalFile Specifies which logical file we want information on. It is a zero based number. If getNumLogicalFiles returns N as the number of logical files, this must be a number between 0 and N-1. FLMUINT uiLevel Level of the B-tree in the logical file we want information on.
Parameters Out:
FLMUINT64 * pui64KeyCount Number of keys at this level of the b-tree. For collections, keys are node ids. FLMUINT64 * pui64BytesUsed Total number of bytes used in blocks at this level of the b-tree. FLMUINT64 * pui64ElementCount Total elements at this level of the b-tree
FLMUINT64 * pui64ContElementCount Total continuation elements at this level of the b-tree.
FLMUINT64 * pui64ContElmBytes Total continuation elements at this level of the b-tree.
FLMUINT * puiBlockCount Total blocks at this level of the b-tree.
FLMINT * piLastError Returns the last corruption error code, if any, at this level of the b-tree.
FLMUINT * puiNumErrors Returns the number of corruptions found in blocks at this level of the b-tree.
Example Code: see getNumCollections.
See Also: