Beispiel #1
0
        void DeleteMissingEntriesOnce()
        {
            if (WasDeletionExecuted == true)
            {
                return;
            }
            WasDeletionExecuted = true;
            if (DisableDeletion == true)
            {
                return;
            }
            var deletions = InputData.Where(row => String.IsNullOrEmpty(row.ChangeAction));

            if (UseTruncateMethod)
            {
                TruncateTableTask.Truncate(this.ConnectionManager, TableName);
            }
            else
            {
                SqlDeleteIds(deletions);
            }
            DeltaTable.AddRange(deletions);
            DeltaTable.ForEach(row =>
            {
                row.ChangeAction = "D";
                row.ChangeDate   = DateTime.Now;
            });
        }
Beispiel #2
0
 public void TestLogging()
 {
     CreateLogTablesTask.CreateLog();
     TruncateTableTask.Truncate("dbo.TRC");
     Assert.IsTrue(new SqlTask("Find log entry", "select count(*) from etl.Log where TaskAction = 'START' and TaskType='TRUNCATE'")
     {
         DisableLogging = true
     }.ExecuteScalarAsBool());
 }
 public void TruncateTableLogging()
 {
     //Arrange
     CreateSimpleTable("etl.TruncateTableLog");
     //Act
     TruncateTableTask.Truncate(SqlConnection, "etl.TruncateTableLog");
     //Assert
     Assert.Equal(2, CountLogEntries("TruncateTableTask"));
 }
Beispiel #4
0
        public void Truncate(IConnectionManager connection)
        {
            //Arrange
            TwoColumnsTableFixture tableDef = new TwoColumnsTableFixture(connection, "TruncateTableTest");

            tableDef.InsertTestData();
            Assert.Equal(3, RowCountTask.Count(connection, "TruncateTableTest"));
            //Act
            TruncateTableTask.Truncate(connection, "TruncateTableTest");
            //Assert
            Assert.Equal(0, RowCountTask.Count(connection, "TruncateTableTest"));
        }
Beispiel #5
0
 private void TruncateDestinationOnce()
 {
     if (WasTruncationExecuted == true)
     {
         return;
     }
     WasTruncationExecuted = true;
     if (MergeMode == MergeMode.NoDeletions || MergeMode == MergeMode.OnlyUpdates)
     {
         return;
     }
     TruncateTableTask.Truncate(this.ConnectionManager, TableName);
 }
Beispiel #6
0
 private void TruncateDestinationOnce()
 {
     if (WasTruncationExecuted == true)
     {
         return;
     }
     WasTruncationExecuted = true;
     if (MergeMode == MergeMode.InsertsAndUpdatesOnly || MergeMode == MergeMode.UpdatesOnly)
     {
         return;
     }
     TruncateTableTask.Truncate(this.ConnectionManager, TableName);
 }
Beispiel #7
0
        void DeleteMissingEntriesOnce()
        {
            var deletions = InputData.Where(row => row.ChangeAction == 0);

            if (DisableDeletion == false && WasDeletionExecuted == false)
            {
                if (UseTruncateMethod)
                {
                    TruncateTableTask.Truncate(TableName);
                }
                else
                {
                    SqlDeleteIds(deletions);
                }
            }
            DeltaTable.AddRange(deletions);
            DeltaTable.ForEach(row => {
                row.ChangeAction = 'D';
                row.ChangeDate   = DateTime.Now;
            });
            WasDeletionExecuted = true;
        }
Beispiel #8
0
 public void TestTruncate()
 {
     Assert.AreEqual(3, RowCountTask.Count("dbo.TRC"));
     TruncateTableTask.Truncate("dbo.TRC");
     Assert.AreEqual(0, RowCountTask.Count("dbo.TRC"));
 }