EssPartitionReadOtlChangeFile

Reads changes from a change file (*.CHG) on the target database into memory. This function is designed to be used interactively with EssPartitionApplyOtlChangeRecs() after a call to EssPartitionGetOtlChanges(). This function can be used with filters.

Syntax

ESS_FUNC_M EssPartitionReadOtlChangeFile (hCtx, pSelectMetaRecords, pMetaChangeRead);
ParameterData TypeDescription

hCtx

ESS_HCTX_T

API context handle.

pSelectMetaRecords

ESS_PARTOTL_SELECT_CHG_T

Criteria to select records to read.

pMetaChangeRead

ESS_PREAD_T

Pointer to meta change records read from the file.

Notes

This routine returns a time in pMetaChangeRead. It's the same time stamp you should pass to EssXXApplyRecords() to update the timestamp at target database. It's also the same time stamp you should use for EssStampPurge() to purge applied records.

Return Value

Returns zero if successful; error code if unsuccessful.

Access

A call to this function requires database designer access privileges.

Example

ESS_FUNC_M ESS_PartitionReadOtlChangeFile(ESS_HCTX_T hCtx, ESS_HINST_T hInst)
{
   ESS_FUNC_M          sts;
   ESS_STR_T          chgfilename;
   ESS_TIME_T         time;
   ESS_PARTOTL_CHANGE_API_T   OtlChg;
   ESS_ULONG_T        uldimfilter=0,ulmbrfilter=0,ulmbrattrfilter=0;
   ESS_PARTOTL_SELECT_CHG_T SelectMetaRecords;
   ESS_PARTOTL_READ_T          MetaChangeRead;
   
   memset(&OtlChg, 0, sizeof(ESS_PARTOTL_CHANGE_API_T));
   memset(&SelectMetaRecords, 0, sizeof(ESS_PARTOTL_SELECT_CHG_T));
   memset(&MetaChangeRead, 0, sizeof(ESS_PARTOTL_READ_T));
   
   chgfilename = "d:\\essbase5\\app\\app1\\trg1\\ess00001.chg";
   time = 0;
   
   uldimfilter     = ESS_DIMCHG_ALL;
   ulmbrfilter     = ESS_PARTITION_OTLMBR_ALL;
   ulmbrattrfilter = ESS_PARTITION_OTLMBRATTR_ALL;
   SelectMetaRecords.pszFileName             = chgfilename;
   SelectMetaRecords.QueryFilter.TimeStamp   = time;
   SelectMetaRecords.QueryFilter.ulDimFilter = uldimfilter;
   SelectMetaRecords.QueryFilter.ulMbrFilter = ulmbrfilter;
   SelectMetaRecords.QueryFilter.ulMbrAttrFilter = ulmbrattrfilter;
 
   MetaChangeRead.pOtlChg = &OtlChg;
   sts = EssPartitionReadOtlChangeFile (hCtx, &SelectMetaRecords, &MetaChangeRead);
   printf("EssPartitionReadOtlChangeFile   sts:  %ld\n",sts);
   sts = EssPartitionFreeOtlChanges(hCtx);
   printf("\tEssPartitionFreeOtlChanges   sts:  %ld\n",sts);
  
   return(sts);
}

See Also