Example #1
0
        private static void Filter(ref VirtualDataTable aTable, string RowFilter, ref bool TableNeedsDispose, string aName)
        {
            RowFilter = RowFilter.Trim();
            if (string.IsNullOrEmpty(RowFilter))
            {
                if (aTable.TableName != aName)
                {
                    VirtualDataTable nTable = aTable.FilterData(aName, null);
                    if (aTable != null && TableNeedsDispose)
                    {
                        aTable.Dispose();
                    }
                    aTable            = nTable;
                    TableNeedsDispose = true;
                }
                return;
            }

            int fPos = RowFilter.IndexOf(ReportTag.StrOpenParen);

            if (fPos > 2)
            {
                if (String.Equals(RowFilter.Substring(0, fPos).Trim(), ReportTag.ConfigTag(ConfigTagEnum.Distinct), StringComparison.InvariantCultureIgnoreCase))
                {
                    if (RowFilter[RowFilter.Length - 1] != ReportTag.StrCloseParen)
                    {
                        FlxMessages.ThrowException(FlxErr.ErrInvalidFilterParen, RowFilter);
                    }

                    VirtualDataTable bTable = aTable.GetDistinct(aName, GetColumnsForDistinct(aTable, RowFilter.Substring(fPos + 1, RowFilter.Length - fPos - 2)));
                    if (aTable != null && TableNeedsDispose)
                    {
                        aTable.Dispose();
                    }
                    aTable = bTable;

                    TableNeedsDispose = true;
                    return;
                }
            }

            VirtualDataTable cTable = aTable.FilterData(aName, RowFilter);

            if (aTable != null && TableNeedsDispose)
            {
                aTable.Dispose();
            }
            aTable            = cTable;
            TableNeedsDispose = true;
        }
Example #2
0
 /// <summary>
 /// Call this method ONLY if the collection owns the objects.
 /// As this is not always the case, we cannot follow a more common Dispose pattern.
 /// </summary>
 public void DestroyTables()
 {
     if (FTable != null && FDisposeVirtualTable)
     {
         FTable.Dispose();
     }
     FTable = null;
 }