# EssGetDatabaseState

Description

EssGetDatabaseState() gets a database's state structure, which contains user-configurable parameters for the database.

Syntax

    ESS_FUNC_M EssGetDatabaseState (hCtx, AppName, DbName, ppDbState);

ESS_HCTX_T | hCtx
ESS_STR_T | AppName
ESS_STR_T | DbName
ESS_PPDBSTATE_T | ppDbState

Parameters

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

Return Value

If successful, this function returns a pointer to an allocated database state structure in ppDbState.

Notes

- This function can get only a server database's state structure.
- The memory allocated for the ppDbState structure must be freed with EssFree().

Access

To get a database's state structure, the connected user must have at least read access to the database.

Example

    ESS_FUNC_M
    ESS_GetCrType (ESS_HCTX_T  hCtx,
                   ESS_HINST_T hInst
                  )
    {
       ESS_FUNC_M        sts = ESS_STS_NOERR;
       ESS_PDBSTATE_T   pDbState;
       ESS_STR_T        AppName;
       ESS_STR_T        DbName;
       AppName = "Sample";
       DbName  = "Basic";
       sts = EssGetDatabaseState (hCtx, AppName,
             DbName, &pDbState);
       if (!sts)
       {
          if (pDbState)
          {
             if (pDbState->CrDbName)
             {
    printf ("Currency Conversion Type Member:      %s\r\n", pDbState->CrTypeMember);
                if (pDbState->CrConvType ==
                    ESS_CRCTYPE_DIV)
    printf ("Currency Conversion Type:             %s\r\n", "ESS_CRCTYPE_DIV");
                else if (pDbState->CrConvType ==
                         ESS_CRCTYPE_MULT)
    printf ("Currency Conversion Type:             %s\r\n", "ESS_CRCTYPE_MULT");
             }
             else
    printf ("No Currency database is set\r\n");
             EssFree (hInst, pDbState);
          }
       }
       return (sts);
    }

See Also

EssGetApplicationState()
EssGetDatabaseInfo()
EssSetDatabaseState()
EssGetDatabaseStats()