EssUpdateFileASO

Sends an update specification to the active aggregate storage database from a file.

Syntax

ESS_FUNC_M EssUpdateFileASO (hDestCtx, hSrcCtx, AppName, DbName, 
FileName, Store, Unlock, ulBufferId);
ParameterData TypeDescription

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.

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.

Access

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

Example

void TestUpdateFileASO(ESS_HCTX_T hCtx, ESS_STR_T AppName, ESS_STR_T DbName)
{
        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];

        ulDuplicateAggregationMethod = ESS_ASO_DATA_LOAD_BUFFER_DUPLICATES_ADD;
        ulOptionsFlags = ESS_ASO_DATA_LOAD_BUFFER_IGNORE_MISSING_VALUES;
        ulSize = 100;
        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 = "data1.txt";

        sts = EssUpdateFileASO (hCtx, hSrcCtx, AppName, DbName, FileName, isStore, isUnlock, ulBufferId);
        printf("EssUpdateFileASO sts: %ld\n",sts);

        /* Commit and delete the buffer */
        ulBufferCnt = 1;
        ulBufferIdAry[0] = ulBufferId;
        ulCommitType = ESS_ASO_DATA_LOAD_BUFFER_STORE_DATA;
        ulActionType = ESS_ASO_DATA_LOAD_BUFFER_COMMIT;
        printf("\nLoad 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