示例#1
0
        // Insert
        protected override void InternalExecuteInsert(Program program, IRow oldRow, IRow newRow, BitArray valueFlags, bool uncheckedValue)
        {
            switch (PropagateInsert)
            {
            case PropagateAction.True:
                using (Row insertRow = new Row(program.ValueManager, SourceNode.DataType.RowType, (NativeRow)newRow.AsNative))
                {
                    insertRow.ValuesOwned = false;
                    SourceNode.Insert(program, oldRow, insertRow, valueFlags, uncheckedValue);
                }
                break;

            case PropagateAction.Ensure:
            case PropagateAction.Ignore:
                using (Row insertRow = new Row(program.ValueManager, SourceNode.DataType.RowType, (NativeRow)newRow.AsNative))
                {
                    insertRow.ValuesOwned = false;
                    using (Row sourceRow = new Row(program.ValueManager, SourceNode.DataType.RowType))
                    {
                        insertRow.CopyTo(sourceRow);
                        using (IRow currentRow = SourceNode.Select(program, sourceRow))
                        {
                            if (currentRow != null)
                            {
                                if (PropagateInsert == PropagateAction.Ensure)
                                {
                                    SourceNode.Update(program, currentRow, insertRow, valueFlags, false, uncheckedValue);
                                }
                            }
                            else
                            {
                                SourceNode.Insert(program, oldRow, insertRow, valueFlags, uncheckedValue);
                            }
                        }
                    }
                }
                break;
            }
        }