特定のAPIコンテキスト・ハンドル(hCtx)を検証します。
構文
ESS_FUNC_M EssValidateHCtx (
hCtx
);
| パラメータ | データ型 | 説明 |
|---|---|---|
hCtx |
ESS_HCTX_T |
検証するAPIコンテキスト・ハンドル。 |
備考
この関数を待機期間延長後に使用すると、プログラムのコンテキスト・ハンドルがサーバーによって認識される状態を確保できます。
戻り値
この関数はコンテキスト・ハンドルが有効な場合は0を戻し、それ以外の場合は無効なコンテキスト・ハンドルを示すエラー・コードを戻します。無効なコンテキスト・ハンドルに対して考えられる理由には、ログインがタイムアウトした、またはユーザーがスーパーバイザによって明示的にログアウトされたなどがあります。
アクセス
この関数には、特別なアクセス権は必要ありません。
例
#include <essapi.h>
char sApplication[] = "accept";
char sDbName[] = "basic";
char sFilename[] = "basic";
char SvrName[] = "local";
char User[] = "test";
char Password[] = "testing";
ESS_HINST_T hInst;
ESS_HCTX_T hCtx;
FILE *fpOutfile;
void ESS_Init()
{
ESS_STS_T sts;
ESS_INIT_T InitStruct = { ESS_API_VERSION, /* This should be set to ESS_API_VERSION */
NULL, /* void pointer to user's message context */
0L, /* max number of context handles required */
255, /* max size of buffer that can be allocated*/
NULL, /* local path to use for file operations */
NULL, /* full path name of message database file */
NULL, /* user-defined memory allocation function */
NULL, /* user-defined memory reallocation function*/
NULL, /* user-defined memory free function */
NULL, /* user-defined message callback function */
NULL, /* user-defined help file path */
0L /* reserved for internal use */
};
if ((sts = EssInit(&InitStruct, &hInst)) != ESS_STS_NOERR)
{ fprintf(stdout, "EssInit failure: %ld\n", sts);
exit ((int) sts);
}
fprintf(stdout, "EssInit sts: %ld\n", sts);
}
void ESS_Login ()
{
ESS_STS_T sts = ESS_STS_NOERR;
ESS_USHORT_T Items;
ESS_PAPPDB_T pAppsDbs = NULL;
sts = EssLogin (hInst, SvrName, User, Password, &Items, &pAppsDbs, &hCtx);
printf("EssLogin sts: %ld\r\n", sts);
}
void ESS_Term()
{
ESS_STS_T sts = ESS_STS_NOERR;
if ((sts = EssTerm(hInst)) != ESS_STS_NOERR)
{
/* error terminating API */
exit((ESS_USHORT_T) sts);
}
fprintf(stdout, "EssTerm sts: %ld\r\n", sts);
}
void ESS_Logout()
{
ESS_STS_T sts = ESS_STS_NOERR;
sts = EssLogout (hCtx);
fprintf(stdout, "\n\nEssLogout sts: %ld\n",sts);
}
void ESS_SetActive()
{
ESS_STS_T sts = ESS_STS_NOERR;
ESS_ACCESS_T Access;
ESS_STR_T AppName;
ESS_STR_T DbName;
AppName = sApplication;
DbName = sDbName;
sts = EssSetActive(hCtx, AppName, DbName, &Access);
fprintf(stdout, "EssSetActive sts: %ld\r\n",sts);
}
/*****************************************************/
/*************** MAIN FUNCTION ***********************/
void main(int argc, char ** argv)
{
ESS_STS_T sts;
ESS_Init();
ESS_Login();
ESS_SetActive();
/* Do something else, not related to Essbase*/
sts = EssValidateHCtx (hCtx);
if (sts) {
ESS_Login() ;
ESS_SetActive();
}
/* Do the actual processing now */
EssClearActive(hCtx);
ESS_Logout();
ESS_Term();
}
関連トピック