EssBeginDataloadASO

Starts a data load on an aggregate storage database.

Syntax

ESS_FUNC_M EssBeginDataloadASO (hCtx, Store, Unlock, abortOnError, pRules, ulBufferId);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle.

Store

ESS_BOOL_T

Controls storage of data. If ESS_TRUE, data is stored in the server; if ESS_FALSE, no data is stored.

Unlock

ESS_BOOL_T

Not supported for aggregate storage databases. You must always pass ESS_FALSE for this parameter.

abortOnError

ESS_BOOL_T

ESS_TRUE indicates that the data load will be aborted in case of errors during the process.

pRules

ESS_OBJDEF_T

Pointer to the rules file object definition structure.

ulBufferId

ESS_ULONG_T

ID of a data load buffer. To destroy a buffer before a data load is complete, you must use the same ulBufferId number that was used to initialize the buffer.

Notes

Return Value

Returns zero if successful; otherwise, returns an error code.

Access

EssBeginDataloadASO() requires the caller to have write privilege (ESS_PRIV_WRITE) to the active database.

Example

void TestBeginDataloadASO(ESS_HCTX_T hCtx, ESS_STR_T AppName, ESS_STR_T DbName)
{
        ESS_STS_T       sts = ESS_STS_NOERR;
        ESS_BOOL_T      Store;
        ESS_BOOL_T      Unlock; 
        ESS_BOOL_T      abortOnError;
        ESS_STR_T       loadString;
        ESS_OBJDEF_T rulesFile; 
        ESS_PMBRERR_T pMbrErr;
        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];

        /* EssLoadBufferInit */
        ulDuplicateAggregationMethod = ESS_ASO_DATA_LOAD_BUFFER_DUPLICATES_ADD;
        ulOptionsFlags = ESS_ASO_DATA_LOAD_BUFFER_IGNORE_MISSING_VALUES;
        ulSize = 100;
        ulBufferId = 201;
        sts = EssLoadBufferInit(hCtx, AppName, DbName, ulBufferId, ulDuplicateAggregationMethod, 
                ulOptionsFlags, ulSize);
        printf("EssLoadBufferInit sts: %ld\n", sts);

        /* EssBeginDataloadASO, EssSendString, EssEndDataload */
        Store  = ESS_TRUE;
        Unlock = ESS_FALSE;
        abortOnError = ESS_FALSE;
        loadString = "Mar Sale \"Curr Year\" \"Original Price\" \"017589\" \"13668\" Cash \"No Promotion\" \"1 to 13 Years\" \"Under 20,000\" \"Digital Cameras\" 111";                   
        sts = EssBeginDataloadASO (hCtx, Store, Unlock, abortOnError, ESS_NULL, ulBufferId);  
        printf("EssBeginDataloadASO sts: %ld\n",sts);
        sts = EssSendString(hCtx, loadString);
        printf("EssSendString sts: %ld\n",sts);
        sts = EssEndDataload(hCtx, &pMbrErr);
        printf("EssEndDataload sts: %ld\n",sts);

        /* EssLoadBufferTerm */
        ulBufferCnt = 1;
        ulBufferIdAry[0] = ulBufferId;
        ulCommitType = ESS_ASO_DATA_LOAD_BUFFER_STORE_DATA;
        ulActionType = ESS_ASO_DATA_LOAD_BUFFER_COMMIT;
        printf("\Commit data 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);

}

See Also