/// <summary> /// fetch-and-compute loop /// </summary> /// <returns></returns> private bool FindMatchingRecord() { bool recordFound = false; if (!StartPosition.IsZero) { GatewayResult result = TaskViews.OpenCursors(Reverse, StartPosition); if (result.Success) { IRecord record; // Looking for one record only do { record = GetBasicRecord(); if (record != null && RecordComputer.Compute(record, true, false, false).Success) { recordFound = true; break; } } while (record != null); } TaskViews.CloseMainCursor(); } return(recordFound); }
/// <summary> /// setup main cursor for fetch /// executed for all types of fetches /// </summary> /// <returns></returns> private GatewayResult SetupMainCursor() { GatewayResult gatewayResult; UpdateViewBoundaries(StartPosition); gatewayResult = TaskViews.OpenCursors(Reverse, StartPosition); //move to strategy ???? if (gatewayResult.Success && StartingPositionType == StartingPositionType.AfterStartingRecord && PositionCache.ContainsValue(startPosition)) { IRecord dummyRecord = DataviewSynchronizer.CreateRecord(); gatewayResult = TaskViews.FetchMain(dummyRecord); } return(gatewayResult); }
internal override ReturnResultBase Execute() { bool isEmptyDataView = ((DataView)(Task.DataView)).isEmptyDataview(); DataviewSynchronizer.SetupDataview(Reverse); IRecord origRecord = DataviewSynchronizer.GetCurrentRecord(); TaskViews.ViewMain.IgnorePositionCache = true; GatewayResult result = TaskViews.OpenCursors(Reverse, new DbPos(true)); if (result.Success) { IRecord record; while ((record = GetBasicRecord()) != null) { if (RecordComputer.Compute(record, true, false, false).Success) { //execute event OnRecordFetchEvent onRecordFetch((Record)record); DataviewSynchronizer.RemoveRecord(record); } } } TaskViews.CloseMainCursor(); TaskViews.ViewMain.IgnorePositionCache = false; if (origRecord != null) { DataviewSynchronizer.SetCurrentRecord(origRecord != null ? origRecord.getId() : Int32.MinValue); ((DataView)(Task.DataView)).takeFldValsFromCurrRec(); } ((DataView)(Task.DataView)).setEmptyDataview(isEmptyDataView); return(result); }