サーバー側でコンパクト化が必要なアウトライン・ファイルをコンパクト化します。
構文
ESS_FUNC_M EssCompactOutline (
hCtx
);
| パラメータ | データ型 | 説明 |
|---|---|---|
hCtx |
ESS_HCTX_T |
ログイン時に取得したAPIコンテキスト。 |
備考
この関数を使用する場合は、ユーザーがアクティブに設定されている必要があります。
戻り値
成功の場合、0が戻されます。このアクションを行っているユーザーが存在しないことを確認後、アウトラインのみの再構築が行われます。
例
#include <windows.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#pragma pack(push, api, 1)
#include <essapi.h>
#include <essotl.h>
#pragma pack(pop, api)
/* default names */
ESS_SVRNAME_T srvrName = "localhost";
ESS_USERNAME_T userName = "essexer";
ESS_PASSWORD_T pswd = "password";
ESS_APPNAME_T app = "ASOSamp";
ESS_DBNAME_T db = "Sample";
int main(int argc, char *argv[ ])
{
ESS_STS_T sts = ESS_STS_NOERR;
ESS_HINST_T hInst = NULL;
ESS_HOUTLINE_T hOutlineQuery = NULL, hOutline = NULL;
ESS_HCTX_T hCtx = NULL;
ESS_USHORT_T Items;
ESS_PAPPDB_T pAppsDbs = NULL;
ESS_ACCESS_T Access;
ESS_INIT_T InitStruct = /* Define init */
/* structure */
{
ESS_API_VERSION, /* Version of API */
(ESS_PVOID_T)0, /* user-defined message context */
0, /* max handles */
0L, /* max buffer size */
NULL, //(ESS_STR_T)"C:\\Hyperion\\products\\Essbase\\EssbaseServer", /* local path */
/* The following parameters use defaults */
NULL, /* message db path */
NULL, /* allocation function pointer */
NULL, /* reallocation function pointer */
NULL, /* free function pointer */
NULL, //(ESS_PFUNC_T)MessageFunc, /* error handling function pointer */
NULL, /* path name of user-defined */
/* Application help file */
0L /* Reserved for internal use. */
/* Set to NULL */
#ifdef AD_UTF8
, ESS_API_UTF8
#endif
};
/* get appname and dbname from the argument list */
if (argc < 6) {
puts(" Usage: EssCompactOtl ServerName Userid Password AppName DbName\n");
exit (0);
}
strcpy(srvrName, argv[1]);
strcpy(userName, argv[2]);
strcpy(pswd, argv[3]);
strcpy(app, argv[4]);
strcpy(db, argv[5]);
/* Initialize the Essbase API */
if ((sts = EssInit(&InitStruct, &hInst)) != ESS_STS_NOERR)
{
printf("EssInit failure: %ld\n", sts);
exit ((int) sts);
}
/* Login to Essbase */
if ((sts = EssLogin (hInst, srvrName, userName, pswd, &Items, &pAppsDbs, &hCtx)) != ESS_STS_NOERR)
{
printf("EssLogin failure: %ld\n", sts);
exit ((int) sts);
}
if(pAppsDbs)
EssFree(hInst, pAppsDbs);
/* Select the application */
if ((sts = EssSetActive(hCtx, app, db, &Access)) != ESS_STS_NOERR)
{
printf("EssSetActive failure: %ld\n", sts);
exit ((int) sts);
}
/* compact the outline and restructure */
if ((sts = EssCompactOutline(hCtx)) != ESS_STS_NOERR)
{
printf("EssCompactOutline failure: %ld\n", sts);
exit ((int) sts);
}
/* done, logout and terminate the api */
if ((sts = EssLogout (hCtx)) != ESS_STS_NOERR)
{
printf("EssLogout failure: %ld\n", sts);
exit ((int) sts);
}
if ((sts = EssTerm(hInst)) != ESS_STS_NOERR)
{
/* error terminating API */
exit((int) sts);
}
return(0);
}