public enRecordsetIndexType GetRecordsetIndexType(string expression) { enRecordsetIndexType result = enRecordsetIndexType.Error; string idx = ExtractIndexRegionFromRecordset(expression); if (idx == "*") { result = enRecordsetIndexType.Star; } else if (string.IsNullOrEmpty(idx)) { result = enRecordsetIndexType.Blank; } else { int convertIntTest; if (Int32.TryParse(idx, out convertIntTest)) { result = enRecordsetIndexType.Numeric; } } return(result); }
/// <summary> /// Fetches the index of the recordset. /// </summary> /// <param name="part">The part.</param> /// <param name="entry">The entry.</param> /// <param name="isFramed"></param> /// <returns></returns> public int FetchRecordsetIndex(IIntellisenseResult part, IBinaryDataListEntry entry, bool isFramed) { // figure out the index type ;) enRecordsetIndexType idxType = DataListUtil.GetRecordsetIndexTypeRaw(part.Option.RecordsetIndex); int result = 1; if (idxType == enRecordsetIndexType.Numeric) { // fix index insert ;) if (!Int32.TryParse(part.Option.RecordsetIndex, out result)) { result = -1; } } else if (idxType == enRecordsetIndexType.Blank) { // append mode if (!_recordsetAppendIndexs.TryGetValue(part.Option.Recordset, out result)) { if (entry != null) { result = entry.FetchAppendRecordsetIndex(); _recordsetAppendIndexs[part.Option.Recordset] = result; // stash in cache } } // Assign behavior ;) if (!isFramed) { // duplicate match ;) if (nonFramedTokens.Contains(part)) { // reset the framing ;) nonFramedTokens.Clear(); nonFramedTokens.Add(part); // inc this index ;) _recordsetAppendIndexs[part.Option.Recordset]++; result++; } else { // current append indexes are alright ;) nonFramedTokens.Add(part); } } } else if (idxType == enRecordsetIndexType.Star) { // overwrite mode from idx 1 if (!_recordsetOverwriteIndexs.TryGetValue(part.Option.Recordset, out result)) { result = 1; _recordsetOverwriteIndexs[part.Option.Recordset] = result; } } return(result); }
private int FetchNumberOfExecutions(IIntellisenseResult part, IBinaryDataList bdl) { int result = 1; if (!part.Option.IsScalar) { // process the recordset... enRecordsetIndexType type = DataListUtil.GetRecordsetIndexType(part.Option.DisplayValue); if (type == enRecordsetIndexType.Star) { // Fetch entry and find the last index IBinaryDataListEntry entry; string error; if (bdl.TryGetEntry(part.Option.Recordset, out entry, out error)) { result = entry.FetchLastRecordsetIndex(); } } else if (type == enRecordsetIndexType.Numeric) { // Fetch index out Int32.TryParse(part.Option.RecordsetIndex, out result); } } return(result); }
/// <summary> /// A new version of GetValue since Evaluate will now handle complex expressions it is now possible to create gnarly looking debug items /// This method handles these ;) /// </summary> /// <param name="dlEntry">The dl entry.</param> /// <param name="indexType">Type of the index.</param> /// <param name="results">The results.</param> /// <param name="initExpression">The init expression.</param> /// <param name="recordField">The record field.</param> /// <param name="index">The index.</param> /// <param name="labelText"></param> void NewGetValue(IBinaryDataListEntry dlEntry, enRecordsetIndexType indexType, IList <IDebugItemResult> results, string initExpression, IBinaryDataListItem recordField, int index, string labelText) { string injectVal = string.Empty; ComplexExpressionAuditor auditorObj = dlEntry.ComplexExpressionAuditor; if (indexType == enRecordsetIndexType.Star && auditorObj != null) { string instanceData; IList <ComplexExpressionAuditItem> auditData = auditorObj.FetchAuditItems(); if (index <= auditData.Count && index > 0) { ComplexExpressionAuditItem useData = auditData[index - 1]; instanceData = useData.TokenBinding; injectVal = useData.BoundValue; } else { string recsetName = DataListUtil.CreateRecordsetDisplayValue(dlEntry.Namespace, recordField.FieldName, index.ToString(CultureInfo.InvariantCulture)); instanceData = DataListUtil.AddBracketsToValueIfNotExist(recsetName); } results.Add(new DebugItemResult { Label = labelText, Type = DebugItemResultType.Variable, Value = injectVal, Operator = string.IsNullOrEmpty(instanceData) ? "" : "=", Variable = instanceData, GroupName = initExpression, GroupIndex = index }); } else { injectVal = recordField.TheValue; string displayValue = recordField.DisplayValue; if (displayValue.IndexOf(GlobalConstants.NullEntryNamespace, StringComparison.Ordinal) >= 0) { displayValue = DataListUtil.CreateRecordsetDisplayValue("Evaluated", GlobalConstants.EvaluationRsField, index.ToString(CultureInfo.InvariantCulture)); } results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Variable = DataListUtil.AddBracketsToValueIfNotExist(displayValue), Operator = string.IsNullOrEmpty(displayValue) ? "" : "=", GroupName = initExpression, Value = injectVal, GroupIndex = index }); } }
static void GetRowIndex(ref bool started, ref int rowIdx, enRecordsetIndexType rsType, string rowIndex) { if (rsType == enRecordsetIndexType.Star && started) { rowIdx = 1; started = false; } if (rsType == enRecordsetIndexType.Numeric) { rowIdx = int.Parse(rowIndex); } }
internal TransientRecordsetProcessGroup(string targetValue, enRecordsetIndexType typeOf, bool isRS) { TargetValue = targetValue; IdxType = typeOf; IsTargetRecordSet = isRS; }
void OldGetValue(IBinaryDataListEntry dlEntry, string value, int iterCnt, string fieldName, enRecordsetIndexType indexType, IList <IDebugItemResult> results, string initExpression, IBinaryDataListItem recordField, int index, string labelText) { if ((string.IsNullOrEmpty(fieldName) || recordField.FieldName.Equals(fieldName, StringComparison.InvariantCultureIgnoreCase))) { string injectVal; try { injectVal = recordField.TheValue; } catch (Exception) { injectVal = ""; } if (!string.IsNullOrEmpty(value) && recordField.ItemCollectionIndex == (iterCnt + 1)) { injectVal = value; _rsCachedValues[recordField.DisplayValue] = injectVal; } else if (string.IsNullOrEmpty(injectVal) && recordField.ItemCollectionIndex != (iterCnt + 1)) { // is it in the cache? ;) _rsCachedValues.TryGetValue(recordField.DisplayValue, out injectVal); if (injectVal == null) { injectVal = string.Empty; } } string recsetName; if (indexType == enRecordsetIndexType.Star) { recsetName = DataListUtil.CreateRecordsetDisplayValue(dlEntry.Namespace, recordField.FieldName, index.ToString(CultureInfo.InvariantCulture)); recsetName = DataListUtil.AddBracketsToValueIfNotExist(recsetName); } else { recsetName = DataListUtil.AddBracketsToValueIfNotExist(recordField.DisplayValue); } results.Add(new DebugItemResult { Label = labelText, Type = DebugItemResultType.Variable, Variable = recsetName, Operator = string.IsNullOrEmpty(recsetName) ? "" : "=", Value = injectVal, GroupName = initExpression, GroupIndex = index }); } }
void GetValue(IBinaryDataListEntry dlEntry, string value, int iterCnt, string fieldName, enRecordsetIndexType indexType, IList <IDebugItemResult> results, string initExpression, IBinaryDataListItem recordField, int index, bool ignoreCompare, string labelText) { if (!ignoreCompare) { OldGetValue(dlEntry, value, iterCnt, fieldName, indexType, results, initExpression, recordField, index, labelText); } else { NewGetValue(dlEntry, indexType, results, initExpression, recordField, index, labelText); } }
void GetValues(IBinaryDataListEntry dlEntry, string value, int iterCnt, IIndexIterator idxItr, enRecordsetIndexType indexType, IList <IDebugItemResult> results, string initExpression, string labelText, string fieldName = null) { string error; int index = idxItr.FetchNextIndex(); if (string.IsNullOrEmpty(fieldName)) { IList <IBinaryDataListItem> record = dlEntry.FetchRecordAt(index, out error); // ReSharper disable LoopCanBeConvertedToQuery foreach (IBinaryDataListItem recordField in record) // ReSharper restore LoopCanBeConvertedToQuery { GetValue(dlEntry, value, iterCnt, fieldName, indexType, results, initExpression, recordField, index, false, labelText); } } else { IBinaryDataListItem recordField = dlEntry.TryFetchRecordsetColumnAtIndex(fieldName, index, out error); bool ignoreCompare = false; if (recordField == null) { if (dlEntry.Columns.Count == 1) { recordField = dlEntry.TryFetchIndexedRecordsetUpsertPayload(index, out error); ignoreCompare = true; } } GetValue(dlEntry, value, iterCnt, fieldName, indexType, results, initExpression, recordField, index, ignoreCompare, labelText); } }
public List <IDebugItemResult> CreateDebugItemsFromEntry(string expression, IBinaryDataListEntry dlEntry, Guid dlId, enDev2ArgumentType argumentType, string labelText, int indexToUse = -1) { var results = new List <IDebugItemResult>(); IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(); IBinaryDataList dataList = compiler.FetchBinaryDataList(dlId, out ErrorsTo); if ( !(expression.Contains(GlobalConstants.CalculateTextConvertPrefix) && expression.Contains(GlobalConstants.CalculateTextConvertSuffix))) { if (!expression.ContainsSafe("[[")) { results.Add(new DebugItemResult { Label = labelText, Type = DebugItemResultType.Value, Value = expression }); return(results); } } else { expression = expression.Replace(GlobalConstants.CalculateTextConvertPrefix, string.Empty) .Replace(GlobalConstants.CalculateTextConvertSuffix, string.Empty); } if (dlEntry != null && dlEntry.ComplexExpressionAuditor == null) { int groupIndex = 0; enRecordsetIndexType rsType = DataListUtil.GetRecordsetIndexType(expression); if (dlEntry.IsRecordset && (DataListUtil.IsValueRecordset(expression) && (rsType == enRecordsetIndexType.Star || (rsType == enRecordsetIndexType.Numeric && DataListUtil.ExtractFieldNameFromValue(expression) == string.Empty) || (rsType == enRecordsetIndexType.Blank && DataListUtil.ExtractFieldNameFromValue(expression) == string.Empty)))) { // Added IsEmpty check for Bug 9263 ;) if (!dlEntry.IsEmpty()) { IList <IDebugItemResult> collection = CreateRecordsetDebugItems(expression, dlEntry, string.Empty, -1, labelText); if (collection.Count < 2 && collection.Count > 0) { collection[0].GroupName = ""; } results.AddRange(collection); } else { results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Label = labelText, Variable = expression, Operator = string.IsNullOrEmpty(expression) ? "" : "=", Value = "", }); } } else { if (DataListUtil.IsValueRecordset(expression) && (DataListUtil.GetRecordsetIndexType(expression) == enRecordsetIndexType.Blank)) { if (indexToUse == -1) { IBinaryDataListEntry tmpEntry; string error; dataList.TryGetEntry(DataListUtil.ExtractRecordsetNameFromValue(expression), out tmpEntry, out error); if (tmpEntry != null) { int index = tmpEntry.FetchAppendRecordsetIndex() - 1; if (index > 0) { groupIndex = index; expression = expression.Replace("().", string.Concat("(", index, ").")); } } } else { expression = expression.Replace("().", string.Concat("(", indexToUse, ").")); } } if (dlEntry.IsRecordset) { var strIndx = DataListUtil.ExtractIndexRegionFromRecordset(expression); int indx; if (int.TryParse(strIndx, out indx)) { if (indx > 0) { IBinaryDataListItem item = dlEntry.FetchScalar(); try { CreateScalarDebugItems(expression, item.TheValue, labelText, results, "", groupIndex); } catch (NullValueInVariableException) { CreateScalarDebugItems(expression, "", labelText, results, "", groupIndex); } } else { CreateScalarDebugItems(expression, "", labelText, results, "", groupIndex); } } else { IBinaryDataListItem itemx = dlEntry.FetchScalar(); if (!string.IsNullOrEmpty(strIndx)) { IBinaryDataListEntry indexBinaryEntry; IBinaryDataListItem indexItem = null; string error; if (DataListUtil.IsValueRecordset(strIndx)) { dataList.TryGetEntry(DataListUtil.ExtractRecordsetNameFromValue(strIndx), out indexBinaryEntry, out error); var fieldName = DataListUtil.ExtractFieldNameFromValue(strIndx); int index; if (int.TryParse(DataListUtil.ExtractIndexRegionFromRecordset(strIndx), out index)) { indexItem = indexBinaryEntry.TryFetchRecordsetColumnAtIndex(fieldName, index, out error); } } else { dataList.TryGetEntry(strIndx, out indexBinaryEntry, out error); indexItem = indexBinaryEntry.FetchScalar(); } if (indexItem != null) { expression = expression.Replace(string.Format("({0})", strIndx), string.Format("({0})", indexItem.TheValue)); } } try { CreateScalarDebugItems(expression, itemx.TheValue, labelText, results, "", groupIndex); } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { } } } else { IBinaryDataListItem item = dlEntry.FetchScalar(); try { CreateScalarDebugItems(expression, item.TheValue, labelText, results, "", groupIndex); } catch (Exception) { CreateScalarDebugItems(expression, null, labelText, results, "", groupIndex); } } } } else { // Complex expressions are handled differently ;) if (dlEntry != null) { ComplexExpressionAuditor auditor = dlEntry.ComplexExpressionAuditor; int idx = 1; foreach (ComplexExpressionAuditItem item in auditor.FetchAuditItems()) { int grpIdx = idx; string groupName = item.RawExpression; string displayExpression = item.RawExpression; if (displayExpression.Contains("().")) { displayExpression = displayExpression.Replace("().", string.Concat("(", auditor.GetMaxIndex(), ").")); } if (displayExpression.Contains("(*).")) { displayExpression = displayExpression.Replace("(*).", string.Concat("(", idx, ").")); } results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Label = labelText, Variable = displayExpression, Operator = string.IsNullOrEmpty(displayExpression) ? "" : "=", GroupName = groupName, Value = item.BoundValue, GroupIndex = grpIdx }); idx++; } } } return(results); }
public List <IDebugItemResult> CreateDebugItemsFromString(string expression, string value, Guid dlId, int iterationNumber, string labelText, enDev2ArgumentType argumentType) { ErrorResultTO errors; IList <IDebugItemResult> resultsToPush = new List <IDebugItemResult>(); IDataListCompiler compiler = DataListFactory.CreateDataListCompiler(); IBinaryDataList dataList = compiler.FetchBinaryDataList(dlId, out errors); if (DataListUtil.IsValueRecordset(expression)) { enRecordsetIndexType recsetIndexType = DataListUtil.GetRecordsetIndexType(expression); string recsetName = DataListUtil.ExtractRecordsetNameFromValue(expression); IBinaryDataListEntry currentRecset; string error; dataList.TryGetEntry(recsetName, out currentRecset, out error); if (recsetIndexType == enRecordsetIndexType.Star) { if (currentRecset != null) { resultsToPush = CreateRecordsetDebugItems(expression, currentRecset, value, iterationNumber, labelText); if (resultsToPush.Count < 2) { resultsToPush[0].GroupName = ""; } } } else if (recsetIndexType == enRecordsetIndexType.Blank) { int recsetIndexToUse = 1; if (currentRecset != null) { if (argumentType == enDev2ArgumentType.Input) { if (!currentRecset.IsEmpty()) { recsetIndexToUse = currentRecset.FetchAppendRecordsetIndex() - 1; } } else if (argumentType == enDev2ArgumentType.Output) { if (!currentRecset.IsEmpty()) { recsetIndexToUse = currentRecset.FetchAppendRecordsetIndex() - 1; } } } recsetIndexToUse = recsetIndexToUse + iterationNumber; expression = expression.Replace("().", string.Concat("(", recsetIndexToUse, ").")); resultsToPush = string.IsNullOrEmpty(value) ? CreateDebugItemsFromEntry(expression, currentRecset, dlId, argumentType) : CreateScalarDebugItems(expression, value, labelText); } else { resultsToPush = string.IsNullOrEmpty(value) ? CreateDebugItemsFromEntry(expression, currentRecset, dlId, argumentType, labelText) : CreateScalarDebugItems(expression, value, labelText); } } else { IBinaryDataListEntry binaryDataListEntry; string error; dataList.TryGetEntry(expression, out binaryDataListEntry, out error); resultsToPush = string.IsNullOrEmpty(value) ? CreateDebugItemsFromEntry(expression, binaryDataListEntry, dlId, argumentType, labelText) : CreateScalarDebugItems(expression, value, labelText); } return(resultsToPush.ToList()); }
// 2 seconds for 10k entries with 75 columns ;) public void FlushIterations(PayloadIterationFrame <string> scopedFrame, bool isFramed, bool isTerminalFlush) { string error; Dev2TokenConverter tc = new Dev2TokenConverter(); bool amendedData = false; // We do not care about data language in these cases, skip all the junk and get it done son ;) while (scopedFrame.HasData()) { DataListPayloadFrameTO <string> tmp = scopedFrame.FetchNextFrameItem(); string exp = tmp.Expression; //.Replace("(*)", "()"); // force conversion ;) string val = tmp.Value; // correction, we now need to support recursive evaluation ;( if (!DataListUtil.IsRootVariable(exp)) { ErrorResultTO errors; var tmpToken = _c.Evaluate(_bdl.UID, enActionType.User, exp, true, out errors); if (errors.HasErrors()) { throw new Exception(errors.MakeDisplayReady()); } var scalar = tmpToken.FetchScalar(); if (scalar == null) { // ReSharper disable RedundantAssignment exp = null; // ReSharper restore RedundantAssignment } exp = tmpToken.FetchScalar().TheValue; } IIntellisenseResult token = tc.ParseTokenForMatch(exp, _bdl.FetchIntellisenseParts()); if (token != null) { // Get rs and field string rs = token.Option.Recordset; string field = token.Option.Field; string idx = token.Option.RecordsetIndex; if (rs != _lastRs && !string.IsNullOrEmpty(rs)) { // Flush any existing row data for a different recordset ;) if (_rowData != null) { if (!token.Option.IsScalar) { DumpColAtATime(); } amendedData = false; } _bdl.TryGetEntry(rs, out _entry, out error); if (error != string.Empty || _entry == null) { throw new Exception("Upsert Exception : " + error); } // stash last rs _lastRs = rs; // build new row data int cnt = _entry.Columns.Count; _rowData = new List <IBinaryDataListItem>(cnt); InitRowBuffer(cnt); } if (!token.Option.IsScalar) { // set commit flag ;) amendedData = true; int colIdx = _entry.InternalFetchColumnIndex(field); IBinaryDataListItem itm = _rowData[colIdx]; enRecordsetIndexType idxType = DataListUtil.GetRecordsetIndexTypeRaw(idx); int tmpIdx = _dris.FetchRecordsetIndex(token, _entry, isFramed); if (tmpIdx != _upsertIdx) { // silly users making algorithms slow ;( // we need to dump data at this point... 1 fliping column at a time DumpColAtATime(); } _upsertIdx = tmpIdx; if (_upsertIdx == 0) { throw new Exception("Invalid recordset index of 0"); } // if numeric fetch the index if (idxType == enRecordsetIndexType.Numeric) { Int32.TryParse(idx, out _upsertIdx); } itm.UpdateIndex(_upsertIdx); itm.UpdateField(field); itm.UpdateValue(val); if (_rowData == null) { throw new Exception("Invalid Bulk Load Data"); } _rowData[colIdx] = itm; } else { IBinaryDataListItem itm = DataListConstants.baseItem.Clone(); // else scalar and we need to get the entry ;( IBinaryDataListEntry scalarEntry; _bdl.TryGetEntry(field, out scalarEntry, out error); itm.UpdateField(field); itm.UpdateValue(val); scalarEntry.TryPutScalar(itm, out error); if (error != string.Empty) { throw new Exception(error); } } } else { throw new Exception("Null token for [ " + exp + " ]"); } } // flush the rowData out ;) if (_entry != null && _entry.IsRecordset && amendedData) { _entry.TryPutRecordRowAt(_rowData, _upsertIdx, out error); if (error != string.Empty) { throw new Exception(error); } _dris.MoveIndexesToNextPosition(); } if (isTerminalFlush) { ErrorResultTO errors; _c.PushBinaryDataListInServerScope(_liveFlushingLocation, _bdl, out errors); } // clear out the buffer ClearRowBuffer(); }
void OldGetValue(IBinaryDataListEntry dlEntry, string value, int iterCnt, string fieldName, enRecordsetIndexType indexType, IList<IDebugItemResult> results, string initExpression, IBinaryDataListItem recordField, int index, string labelText) { if((string.IsNullOrEmpty(fieldName) || recordField.FieldName.Equals(fieldName, StringComparison.InvariantCultureIgnoreCase))) { string injectVal; try { injectVal = recordField.TheValue; } catch(Exception) { injectVal = ""; } if(!string.IsNullOrEmpty(value) && recordField.ItemCollectionIndex == (iterCnt + 1)) { injectVal = value; _rsCachedValues[recordField.DisplayValue] = injectVal; } else if(string.IsNullOrEmpty(injectVal) && recordField.ItemCollectionIndex != (iterCnt + 1)) { // is it in the cache? ;) _rsCachedValues.TryGetValue(recordField.DisplayValue, out injectVal); if(injectVal == null) { injectVal = string.Empty; } } string recsetName; if(indexType == enRecordsetIndexType.Star) { recsetName = DataListUtil.CreateRecordsetDisplayValue(dlEntry.Namespace, recordField.FieldName, index.ToString(CultureInfo.InvariantCulture)); recsetName = DataListUtil.AddBracketsToValueIfNotExist(recsetName); } else { recsetName = DataListUtil.AddBracketsToValueIfNotExist(recordField.DisplayValue); } results.Add(new DebugItemResult { Label = labelText, Type = DebugItemResultType.Variable, Variable = recsetName, Operator = string.IsNullOrEmpty(recsetName) ? "" : "=", Value = injectVal, GroupName = initExpression, GroupIndex = index }); } }
/// <summary> /// A new version of GetValue since Evaluate will now handle complex expressions it is now possible to create gnarly looking debug items /// This method handles these ;) /// </summary> /// <param name="dlEntry">The dl entry.</param> /// <param name="indexType">Type of the index.</param> /// <param name="results">The results.</param> /// <param name="initExpression">The init expression.</param> /// <param name="recordField">The record field.</param> /// <param name="index">The index.</param> /// <param name="labelText"></param> void NewGetValue(IBinaryDataListEntry dlEntry, enRecordsetIndexType indexType, IList<IDebugItemResult> results, string initExpression, IBinaryDataListItem recordField, int index, string labelText) { string injectVal = string.Empty; ComplexExpressionAuditor auditorObj = dlEntry.ComplexExpressionAuditor; if(indexType == enRecordsetIndexType.Star && auditorObj != null) { string instanceData; IList<ComplexExpressionAuditItem> auditData = auditorObj.FetchAuditItems(); if(index <= auditData.Count && index > 0) { ComplexExpressionAuditItem useData = auditData[index - 1]; instanceData = useData.TokenBinding; injectVal = useData.BoundValue; } else { string recsetName = DataListUtil.CreateRecordsetDisplayValue(dlEntry.Namespace, recordField.FieldName, index.ToString(CultureInfo.InvariantCulture)); instanceData = DataListUtil.AddBracketsToValueIfNotExist(recsetName); } results.Add(new DebugItemResult { Label = labelText, Type = DebugItemResultType.Variable, Value = injectVal, Operator = string.IsNullOrEmpty(instanceData) ? "" : "=", Variable = instanceData, GroupName = initExpression, GroupIndex = index }); } else { injectVal = recordField.TheValue; string displayValue = recordField.DisplayValue; if(displayValue.IndexOf(GlobalConstants.NullEntryNamespace, StringComparison.Ordinal) >= 0) { displayValue = DataListUtil.CreateRecordsetDisplayValue("Evaluated", GlobalConstants.EvaluationRsField, index.ToString(CultureInfo.InvariantCulture)); } results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Variable = DataListUtil.AddBracketsToValueIfNotExist(displayValue), Operator = string.IsNullOrEmpty(displayValue) ? "" : "=", GroupName = initExpression, Value = injectVal, GroupIndex = index }); } }
void GetValue(IBinaryDataListEntry dlEntry, string value, int iterCnt, string fieldName, enRecordsetIndexType indexType, IList<IDebugItemResult> results, string initExpression, IBinaryDataListItem recordField, int index, bool ignoreCompare, string labelText) { if(!ignoreCompare) { OldGetValue(dlEntry, value, iterCnt, fieldName, indexType, results, initExpression, recordField, index, labelText); } else { NewGetValue(dlEntry, indexType, results, initExpression, recordField, index, labelText); } }
void GetValues(IBinaryDataListEntry dlEntry, string value, int iterCnt, IIndexIterator idxItr, enRecordsetIndexType indexType, IList<IDebugItemResult> results, string initExpression, string labelText, string fieldName = null) { string error; int index = idxItr.FetchNextIndex(); if(string.IsNullOrEmpty(fieldName)) { IList<IBinaryDataListItem> record = dlEntry.FetchRecordAt(index, out error); // ReSharper disable LoopCanBeConvertedToQuery foreach(IBinaryDataListItem recordField in record) // ReSharper restore LoopCanBeConvertedToQuery { GetValue(dlEntry, value, iterCnt, fieldName, indexType, results, initExpression, recordField, index, false, labelText); } } else { IBinaryDataListItem recordField = dlEntry.TryFetchRecordsetColumnAtIndex(fieldName, index, out error); bool ignoreCompare = false; if(recordField == null) { if(dlEntry.Columns.Count == 1) { recordField = dlEntry.TryFetchIndexedRecordsetUpsertPayload(index, out error); ignoreCompare = true; } } GetValue(dlEntry, value, iterCnt, fieldName, indexType, results, initExpression, recordField, index, ignoreCompare, labelText); } }
IList <IDebugItemResult> CreateRecordsetDebugItems(string expression, IBinaryDataListEntry dlEntry, string value, int iterCnt, string labelText) { var results = new List <IDebugItemResult>(); if (dlEntry.ComplexExpressionAuditor == null) { string initExpression = expression; string fieldName = DataListUtil.ExtractFieldNameFromValue(expression); enRecordsetIndexType indexType = DataListUtil.GetRecordsetIndexType(expression); if (indexType == enRecordsetIndexType.Blank && string.IsNullOrEmpty(fieldName)) { indexType = enRecordsetIndexType.Star; } if (indexType == enRecordsetIndexType.Star || indexType == enRecordsetIndexType.Numeric) { IIndexIterator idxItr = dlEntry.FetchRecordsetIndexes(); while (idxItr.HasMore()) { GetValues(dlEntry, value, iterCnt, idxItr, indexType, results, initExpression, labelText, fieldName); } } } else { // Complex expressions are handled differently ;) ComplexExpressionAuditor auditor = dlEntry.ComplexExpressionAuditor; enRecordsetIndexType indexType = DataListUtil.GetRecordsetIndexType(expression); foreach (ComplexExpressionAuditItem item in auditor.FetchAuditItems()) { int grpIdx = -1; try { grpIdx = Int32.Parse(DataListUtil.ExtractIndexRegionFromRecordset(item.TokenBinding)); } // ReSharper disable EmptyGeneralCatchClause catch (Exception) // ReSharper restore EmptyGeneralCatchClause { // Best effort ;) } if (indexType == enRecordsetIndexType.Star) { string displayExpression = item.Expression.Replace(item.Token, item.RawExpression); results.Add(new DebugItemResult { Type = DebugItemResultType.Variable, Value = displayExpression, GroupName = displayExpression, GroupIndex = grpIdx }); results.Add(new DebugItemResult { Type = DebugItemResultType.Label, Value = GlobalConstants.EqualsExpression, GroupName = displayExpression, GroupIndex = grpIdx }); results.Add(new DebugItemResult { Type = DebugItemResultType.Value, Value = item.BoundValue, GroupName = displayExpression, GroupIndex = grpIdx }); } } } return(results); }