示例#1
0
        public void AddRow(string key, IReadOnlySlimRow row)
        {
            if (string.IsNullOrEmpty(key))
            {
                return;
            }

            Count++;
            if (_dictionary.TryGetValue(key, out var entry))
            {
                if (entry is List <IReadOnlySlimRow> list)
                {
                    list.Add(row);
                }
                else
                {
                    _dictionary[key] = new List <IReadOnlySlimRow>()
                    {
                        entry as IReadOnlySlimRow,
                        row,
                    };
                }
            }
            else
            {
                _dictionary[key] = row;
            }
        }
示例#2
0
 public ColumnRenameException(IProcess process, IReadOnlySlimRow row, string currentName, string newName)
     : base(process, "specified target column already exists")
 {
     Data.Add("CurrentName", currentName);
     Data.Add("NewName", newName);
     Data.Add("Row", row.ToDebugString(true));
 }
示例#3
0
 public override void TransformAggregate(IReadOnlySlimRow row, ContinuousAggregate aggregate)
 {
     foreach (var aggregator in Aggregators)
     {
         aggregator.Invoke(aggregate, row);
     }
 }
示例#4
0
 public SlimRow(IReadOnlySlimRow initialValues)
 {
     _values = initialValues is SlimRow slimRow
         ? new Dictionary <string, object>(slimRow._values, StringComparer.OrdinalIgnoreCase)
         : initialValues is DictionaryRow dictionaryRow
             ? new Dictionary <string, object>(dictionaryRow._values, StringComparer.OrdinalIgnoreCase)
             : new Dictionary <string, object>(initialValues.Values, StringComparer.OrdinalIgnoreCase);
 }
示例#5
0
        public InvalidValueException(IProcess process, IReadOnlySlimRow row, string column)
            : base(process, "invalid value found")
        {
            var value = row[column];

            Data.Add("Column", column);
            Data.Add("Value", value != null ? value.ToString() + " (" + value.GetType().GetFriendlyTypeName() + ")" : "NULL");
            Data.Add("Row", row.ToDebugString(true));
        }
示例#6
0
        public void AddRow(string key, IReadOnlySlimRow row)
        {
            if (string.IsNullOrEmpty(key))
                return;

            Count++;
            _dictionary.TryGetValue(key, out var count);
            _dictionary[key] = count + 1;
        }
    public bool Equals(IReadOnlySlimRow leftRow, IReadOnlySlimRow rightRow)
    {
        if (ComparerDelegate == null)
        {
            throw new ArgumentException(nameof(ComparerDelegate) + " can not be null");
        }

        return(ComparerDelegate.Invoke(leftRow, rightRow));
    }
        public static ProcessExecutionException Wrap(IProcess process, IReadOnlySlimRow row, Exception ex)
        {
            if (ex is ProcessExecutionException pex && (pex.Data["Row"] is string rowString) && string.Equals(rowString, row.ToDebugString(), StringComparison.Ordinal))
            {
                return(pex);
            }

            return(new ProcessExecutionException(process, row, ex));
        }
        public string CreateRowStatement(NamedConnectionString connectionString, IReadOnlySlimRow row, WriteToTableMutator operation)
        {
            var startIndex = operation.ParameterCount;

            foreach (var column in _tableDefinition.Columns)
            {
                operation.CreateParameter(column, row[column.RowColumn]);
            }

            var statement = "(" + string.Join(", ", _tableDefinition.Columns.Select(_ => "@" + startIndex++.ToString("D", CultureInfo.InvariantCulture))) + ")";

            return(statement);
        }
示例#10
0
        public IRow CreateRow(IProcess process, IReadOnlySlimRow source)
        {
            var row = (IRow)Activator.CreateInstance(RowType);

            row.Init(this, process, Interlocked.Increment(ref _nextRowUid), source.Values);
            row.Tag = source.Tag;

            foreach (var listener in Listeners)
            {
                listener.OnRowCreated(row, process);
            }

            return(row);
        }
 public static EtlException Wrap(IProcess process, IReadOnlySlimRow row, Exception ex)
 {
     if (ex is KeyGeneratorException eex)
     {
         var str = row.ToDebugString(true);
         if ((eex.Data["Row"] is string rowString) && string.Equals(rowString, str, StringComparison.Ordinal))
         {
             return(eex);
         }
         else
         {
             eex.Data["Row"] = str;
             return(eex);
         }
     }
示例#12
0
        public bool Equals(IReadOnlySlimRow leftRow, IReadOnlySlimRow rightRow)
        {
            if (leftRow == rightRow)
            {
                return(true);
            }

            if (leftRow == null || rightRow == null)
            {
                return(false);
            }

            if (Columns != null)
            {
                if (ColumnsToIgnore != null)
                {
                    throw new ArgumentException(nameof(ColumnsToIgnore) + " can not be set if " + nameof(Columns) + " is set");
                }

                foreach (var column in Columns)
                {
                    if (!DefaultValueComparer.ValuesAreEqual(leftRow[column], rightRow[column]))
                    {
                        return(false);
                    }
                }
            }
            else
            {
                var columnsToIgnore = ColumnsToIgnore != null
                    ? new HashSet <string>(ColumnsToIgnore)
                    : null;

                foreach (var kvp in leftRow.Values)
                {
                    if (columnsToIgnore?.Contains(kvp.Key) == true)
                    {
                        continue;
                    }

                    if (!DefaultValueComparer.ValuesAreEqual(kvp.Value, rightRow[kvp.Key]))
                    {
                        return(false);
                    }
                }

                foreach (var kvp in rightRow.Values)
                {
                    if (columnsToIgnore?.Contains(kvp.Key) == true)
                    {
                        continue;
                    }

                    if (!DefaultValueComparer.ValuesAreEqual(kvp.Value, leftRow[kvp.Key]))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
示例#13
0
 public RowContainsErrorException(IProcess process, IReadOnlySlimRow row)
     : base(process, "error found in a row")
 {
     Data.Add("Row", row.ToDebugString(true));
 }
示例#14
0
 public NoMatchException(IProcess process, IReadOnlySlimRow row, string key)
     : base(process, "no match")
 {
     Data.Add("Row", row.ToDebugString(true));
     Data.Add("Key", key);
 }
示例#15
0
 public void AddRow(IReadOnlySlimRow row)
 {
     _queue?.Enqueue(row);
 }
 public abstract void TransformAggregate(IReadOnlySlimRow row, ContinuousAggregate aggregate);
示例#17
0
 public ProcessExecutionException(IProcess process, IReadOnlySlimRow row, Exception innerException)
     : this(process, "error raised during the execution of a process", innerException)
 {
     Data.Add("Row", row.ToDebugString());
 }
示例#18
0
 public JoinMatchCustomActionDelegateException(IProcess process, Exception innerException, string delegateName, IReadOnlySlimRow row, IReadOnlySlimRow match)
     : base(process, "error during the execution of a " + delegateName + " delegate", innerException)
 {
     Data.Add("Row", row.ToDebugString(true));
     Data.Add("Match", match.ToDebugString());
 }
示例#19
0
 public void Copy(IReadOnlySlimRow sourceRow, List <KeyValuePair <string, object> > targetValues)
 {
     targetValues.Add(new KeyValuePair <string, object>(ToColumn, sourceRow[FromColumn]));
 }
 public DuplicateKeyException(IProcess process, IReadOnlySlimRow row, string key)
     : base(process, "duplicate keys found")
 {
     Data.Add("Key", key);
     Data.Add("Row", row.ToDebugString(true));
 }
示例#21
0
 public ProcessExecutionException(IProcess process, IReadOnlySlimRow row, string message, Exception innerException)
     : base(process, message, innerException)
 {
     Data.Add("Row", row.ToDebugString());
 }
示例#22
0
 public MatchException(IProcess process, IReadOnlySlimRow row)
     : base(process, "match")
 {
     Data.Add("Row", row.ToDebugString(true));
 }
示例#23
0
 public InvalidValuesException(IProcess process, IReadOnlySlimRow row)
     : base(process, "invalid values found")
 {
     Data.Add("Row", row.ToDebugString(true));
 }
 public KeyGeneratorException(IProcess process, IReadOnlySlimRow row, Exception innerException)
     : base(process, "error during generating key for a row", innerException)
 {
     Data.Add("Row", row.ToDebugString(true));
 }
示例#25
0
 public TooManyMatchActionDelegateException(IProcess process, IReadOnlySlimRow row, Exception innerException)
     : base(process, "error during the execution of a " + nameof(TooManyMatchAction) + "." + nameof(TooManyMatchAction.CustomAction) + " delegate", innerException)
 {
     Data.Add("Row", row.ToDebugString(true));
 }