Sends an update specification to the active aggregate storage database from a file, capturing any data load errors in ppMbrError.
Syntax
ESS_FUNC_M EssUpdateFileASOEx (hDestCtx, hSrcCtx, AppName, DbName, FileName, Store, Unlock, ulBufferId, ppMbrError);| Parameter | Data Type | Description |
|---|---|---|
hDestCtx | ESS_HCTX_T | API context handle of target database on the server. |
hSrcCtx | ESS_HCTX_T | API context handle for update file location. The update file can reside on the client or on the same server as the target database. |
AppName | ESS_STR_T | Application name for update file location. |
DbName | ESS_STR_T | Database name for update file location |
FileName | ESS_STR_T | Name of update specification file. |
Store | ESS_BOOL_T | Controls storage of data. If TRUE, data is stored in the server; if FALSE, no data is stored. |
Unlock | ESS_BOOL_T | Not supported for aggregate storage databases. You must always pass ESS_FALSE for this parameter. |
ulBufferId | ESS_ULONG_T | ID number for the data load buffer. |
ppMbrError | ESS_PPMBRERR_T | Pointer to linked list of errors contained in ESS_MBRERR_T. Possible errors are:
|
Notes
If the Store flag is set to FALSE, the database merely performs a syntax check of the update specification.
Return Value
Returns zero if successful; otherwise, returns an error code and the records that caused the error.
Access
This function requires the caller to have write privilege (ESS_PRIV_WRITE) to the active database.
Example
void TestUpdateFileASOEx()
{
ESS_STS_T sts = ESS_STS_NOERR;
ESS_HCTX_T hSrcCtx;
ESS_BOOL_T isStore;
ESS_BOOL_T isUnlock;
ESS_STR_T FileName;
ESS_ULONG_T ulBufferId;
ESS_ULONG_T ulDuplicateAggregationMethod;
ESS_ULONG_T ulOptionsFlags;
ESS_ULONG_T ulSize;
ESS_ULONG_T ulBufferCnt;
ESS_ULONG_T ulCommitType ;
ESS_ULONG_T ulActionType;
ESS_ULONG_T ulOptions;
ESS_ULONG_T ulBufferIdAry[1];
ESS_PMBRERR_T pMbrError;
ulDuplicateAggregationMethod = ESS_ASO_DATA_LOAD_BUFFER_DUPLICATES_ADD;
ulOptionsFlags = ESS_ASO_DATA_LOAD_BUFFER_IGNORE_MISSING_VALUES;
ulSize = 1;
ulBufferId = 101;
sts = EssLoadBufferInit(hCtx, AppName, DbName, ulBufferId, ulDuplicateAggregationMethod,
ulOptionsFlags, ulSize);
printf("EssLoadBufferInit sts: %ld\n", sts);
/* Update from server*/
hSrcCtx = hCtx;
isStore = ESS_TRUE;
isUnlock = ESS_FALSE;
FileName = "apgeaso1.txt";
sts = EssUpdateFileASOEx (hCtx, hSrcCtx, AppName, DbName, FileName, isStore, isUnlock, ulBufferId, &pMbrError);
printf("EssUpdateFileASOEx sts: %ld\n",sts);
if(!sts)
{
printf("\nMember Error Info:\n");
if(pMbrError)
DisplayError(pMbrError);
else
printf("\tError structure is empty.\n");
}
ulBufferCnt = 1;
ulBufferIdAry[0] = ulBufferId;
ulCommitType = ESS_ASO_DATA_LOAD_BUFFER_STORE_DATA;
ulActionType = ESS_ASO_DATA_LOAD_BUFFER_COMMIT;
printf("\nIncrement to main slice and destroy buffer:\n");
ulOptions = ESS_ASO_DATA_LOAD_INCR_TO_MAIN_SLICE;
sts = EssLoadBufferTerm(hCtx, AppName, DbName, ulBufferCnt, ulBufferIdAry, ulCommitType,
ulActionType, ulOptions);
printf("EssLoadBufferTerm sts: %ld\n",sts);
if(!sts)
{
VerifyDataload("'Mar' 'Sale' 'Curr Year' 'Original Price' '017589' '13668' 'Cash' 'No Promotion' '1 to 13 Years' 'Under 20,000' 'Digital Cameras' 10\n 'Camcorders' 20\n 'Photo Printers' 30 !");
}
if(pMbrError)
EssFree(hInst, pMbrError);
}See Also