Esempio n. 1
0
 public void PutDropMaterialized(SqlScriptCompiler cmp)
 {
     if (_materializedName == null) return;
     cmp.Dumper.DropTable(new TableInfo(null) { FullName = _materializedName }, false);
     cmp.EndCommand();
 }
Esempio n. 2
0
        private void RunCoreRound1(SqlScriptCompiler cmp)
        {
            if (_dbsh.LifetimeHandler.CreateMarkRelived)
            {
                var update = CompileMarkRelived();
                if (update != null)
                {
                    cmp.StartTimeMeasure("OP");
                    cmp.PutSmallTitleComment("MARK RELIVED");
                    cmp.GenCommandSql(update);
                    cmp.EndCommand();
                    cmp.PutLogMessage(this, LogOperationType.MarkRelived, "@rows rows marked as relived", "OP");
                }
            }

            if (_dbsh.LifetimeHandler.CreateMarkDeleted)
            {
                var update = CompileMarkDeleted();
                if (update != null)
                {
                    cmp.StartTimeMeasure("OP");
                    cmp.PutSmallTitleComment("MARK DELETED");
                    cmp.GenCommandSql(update);
                    cmp.PutLogMessage(this, LogOperationType.MarkDeleted, "@rows rows marked as deleted", "OP");
                }
            }

            if (_dbsh.LifetimeHandler.CreateMarkUpdated)
            {
                var update = CompileMarkUpdated();
                if (update != null)
                {
                    cmp.StartTimeMeasure("OP");
                    cmp.PutSmallTitleComment("MARK UPDATED");
                    cmp.GenCommandSql(update);
                    cmp.PutLogMessage(this, LogOperationType.MarkUpdated, "@rows rows marked as updated", "OP");
                }
            }

            if (_dbsh.LifetimeHandler.CreateInsert)
            {
                var insert = CompileInsert();
                if (insert != null)
                {
                    cmp.StartTimeMeasure("OP");
                    cmp.PutSmallTitleComment("INSERT");
                    bool isIdentity = Structure != null && Structure.Columns.Any(x => x.AutoIncrement && insert.TargetColumns.Contains(x.Name));
                    if (isIdentity) cmp.GenCommandSql(dmp => dmp.AllowIdentityInsert(insert.TargetTable, true));
                    cmp.GenCommandSql(insert);
                    cmp.PutLogMessage(this, LogOperationType.Insert, "@rows rows inserted", "OP");
                    if (isIdentity) cmp.GenCommandSql(dmp => dmp.AllowIdentityInsert(insert.TargetTable, false));
                }
            }

            if (_dbsh.LifetimeHandler.CreateUpdate)
            {
                var update = CompileUpdate();
                if (update != null)
                {
                    cmp.StartTimeMeasure("OP");
                    cmp.PutSmallTitleComment("UPDATE");
                    cmp.GenCommandSql(update);
                    cmp.PutLogMessage(this, LogOperationType.Update, "@rows rows updated", "OP");
                }
            }
        }