# EssGetDatabaseStats

Description

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

Syntax

    ESS_FUNC_M EssGetDatabaseStats (hCtx, AppName, DbName, ppDbStats);

ESS_HCTX_T | hCtx
ESS_STR_T | AppName
ESS_STR_T | DbName
ESS_PPDBSTATS_T | ppDbStats

Parameters

hCtx | Essbase API context handle
AppName | Application name
DbName | Database name
ppDbStats | Address of pointer to receive allocated database stats structure pointer

Return Value

If successful, this function returns a pointer to an allocated database stats structure in ppDbStats.

Notes

- This function can only be called for server databases.
- This function will load the database if it is not loaded.
- The memory allocated for ppDbStats should be freed using EssFree().

Access

This function requires the caller to have at least read access (ESS_PRIV_READ) to the database, and to have selected it as their active database using EssSetActive().

Example

    ESS_FUNC_M
    ESS_GetDbStats (ESS_HCTX_T  hCtx,
                    ESS_HINST_T hInst
                   )
    {
       ESS_FUNC_M        sts = ESS_STS_NOERR;
       ESS_PDBSTATS_T   pDbStats;
       ESS_STR_T        AppName;
       ESS_STR_T        DbName;
       AppName = "Sample";
       DbName  = "Basic";

       sts = EssGetDatabaseStats (hCtx, AppName,
             DbName, &pDbStats);
       if (!sts)
       {
          if (pDbStats)
          {
             EssFree (hInst, pDbStats);
          }
       }

       return(sts);
    }

See Also

EssGetDatabaseInfo()
EssGetDatabaseState()