예제 #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;
            });
        }
예제 #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"));
 }
예제 #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"));
        }
예제 #5
0
 private void TruncateDestinationOnce()
 {
     if (WasTruncationExecuted == true)
     {
         return;
     }
     WasTruncationExecuted = true;
     if (MergeMode == MergeMode.NoDeletions || MergeMode == MergeMode.OnlyUpdates)
     {
         return;
     }
     TruncateTableTask.Truncate(this.ConnectionManager, TableName);
 }
예제 #6
0
 private void TruncateDestinationOnce()
 {
     if (WasTruncationExecuted == true)
     {
         return;
     }
     WasTruncationExecuted = true;
     if (MergeMode == MergeMode.InsertsAndUpdatesOnly || MergeMode == MergeMode.UpdatesOnly)
     {
         return;
     }
     TruncateTableTask.Truncate(this.ConnectionManager, TableName);
 }
예제 #7
0
파일: DBMerge.cs 프로젝트: johnmay1/etlbox
        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;
        }
예제 #8
0
 public void TestTruncate()
 {
     Assert.AreEqual(3, RowCountTask.Count("dbo.TRC"));
     TruncateTableTask.Truncate("dbo.TRC");
     Assert.AreEqual(0, RowCountTask.Count("dbo.TRC"));
 }