EssAsyncImport

Issues an asynchronous data load request.

If you use asynchronous data loads and dimension builds, you can query for the following information during the process:

Syntax

ESS_FUNC_M EssAsyncImport (hCtx, pRules, pData, pMbrUser, abortOnError);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle.

pRules

ESS_POBJDEF_T

Pointer to the rules file object definition structure.

pData

ESS_POBJDEF_T

Pointer to the data file object definition structure.

pMbrUser

ESS_PMBRUSER_T

Pointer to the SQL user structure (if data source is a SQL database). A NULL SQL user structure indicates a non SQL data source.

abortOnError

ESS_USHORT_T

If TRUE, import stops on the first error. Otherwise, it continues.

Notes

This function returns an error if the data object is located on the client. The network connection between client and server remains active even if an error is returned.

You must call EssCloseAsyncProc to close the connection; otherwise, the server request handler blocks further requests from the same login session.

Return Value

Returns zero if successful. Otherwise, returns an error code.

Access

This function requires the caller to have database designer privilege for the specified database (ESS_PRIV_DBDESIGN).

Example

ESS_AsyncImport()
{
	ESS_STS_T sts = ESS_STS_NOERR;
	ESS_SHORT_T isAbortOnError;
	ESS_OBJDEF_T Rules;
	ESS_OBJDEF_T Data;
	ESS_PMBRUSER_T pUser;                 
	ESS_STR_T errorName;
	ESS_BLDDL_STATE_T procState;
	ESS_BOOL_T errFileOverWrite;

	szAppName = "Sample";
	szDbName = "Basic";
	ESS_SetActive();

	memset(&Rules,0,sizeof(ESS_OBJDEF_T));
	memset(&Data,0,sizeof(ESS_OBJDEF_T));
	Rules.hCtx     = hCtx;
	Rules.FileName = "Act1"; 
	Rules.AppName  = szAppName;
	Rules.DbName   = szDbName;
	Rules.ObjType  = ESS_OBJTYPE_RULES;  
	Data.hCtx      = hCtx;
	Data.FileName = "Act1"; 
	Data.AppName   = szAppName;
	Data.DbName    = szDbName;
	Data.ObjType   = ESS_OBJTYPE_TEXT;    

	errorName = ".\\asyncProcess.err";
	errFileOverWrite = ESS_TRUE;
	isAbortOnError = ESS_TRUE;
	pUser = ESS_NULL;   /* NULL equals a non-SQL data source */
	sts = EssAsyncImport (hCtx, &Rules, &Data, pUser, isAbortOnError);
	printf("EssAsyncImport sts: %ld\n",sts);

	sts = EssGetAsyncProcState(hCtx, &procState);
	printf("EssGetAsyncProcState sts: %ld\n",sts);
	if(!sts)
	{
		do
		{
			DisplyProcesStateInfo(procState);
			if(procState.ilProcessStatus)
			{
				sts = EssCancelAsyncProc(hCtx, errorName, errFileOverWrite);
				printf("EssCancelAsyncProc sts: %ld\n",sts);
			}
			else
			{
				sts = EssGetAsyncProcState(hCtx, &procState);
				printf("EssGetAsyncProcState sts: %ld\n",sts);
			}

		}while(procState.usProcessState != ESS_BLDDL_STATE_DONE);
		
		if(!procState.ilProcessStatus)
		{
			sts = EssCloseAsyncProc(hCtx, &procState);
			printf("EssCloseAsyncProc sts: %ld\n",sts);
		}
	}
}

See Also