# EsbGetDatabaseStats

Description

EsbGetDatabaseStats() gets the active database's stats structure, which contains statistical information about the database.

Syntax

    EsbGetDatabaseStats (hCtx, AppName, DbName, pDbStats, pItems)

    ByVal hCtx     As Long
    ByVal AppName  As String
    ByVal DbName   As String
          pDbStats As ESB_PDBSTATS_T
          pItems   As Integer

Parameters

hCtx | Essbase VB API context handle.
AppName | Application name.
DbName | Database name.
pDbStats | Buffer to receive a database stats structure.
pItems | Address of variable to receive Items of Dimension stats items.

Return Value

If successful, this function returns a pointer to an allocated database stats structure in pDbStats, the number of dimensions in pItems and generates a list of Dimension stats structures accessible via GetNextItem() .

Notes

- This function can only be called for server databases.
- This function will load the database if it is not loaded.

Access

This function requires the caller to have access to the database, and to have selected it as their active database using EsbSetActive().

Example

    Declare Function EsbGetDatabaseStats Lib "ESBAPIW" (ByVal hCtx As Long, ByVal AppName As String, ByVal DbName As String, DbStats As ESB_DBSTATS_T, Items As Integer) As Long

    Sub ESB_GetDatabaseStats ()
       Dim Items As Integer
       Dim AppName As String
       Dim DbName As String
       Dim DbStats As ESB_DBSTATS_T
       Dim DimStats As ESB_DIMSTATS_T
       Dim sts As Long

       AppName = "Sample"
       DbName = "Basic"

       '*******************
       ' Get Database stats
       '*******************
       sts = EsbGetDatabaseStats (hCtx, AppName, DbName, DbStats, Items)

       For n = 1 To Items

         '******************************
         ' Get next Dimension stats item
         'from the list
         '******************************
         sts = EsbGetNextItem (hCtx,
         ESB_DIMSTATS_TYPE, DimStats)
       Next
    End Sub

See Also

EsbGetDatabaseInfo()
EsbGetDatabaseState()
EsbGetNextItem()
EsbSetActive()