protected override void AppendTo(SqlStringBuilder builder)
 {
     builder.Append("ALTER TRIGGER ");
     TriggerName.AppendTo(builder);
     builder.Append(" ");
     Action.AppendTo(builder);
 }
Esempio n. 2
0
        protected override void AppendTo(SqlStringBuilder builder)
        {
            builder.Append("CREATE ");

            if (ReplaceIfExists)
            {
                builder.Append("OR REPLACE ");
            }

            builder.Append("TRIGGER ");
            TriggerName.AppendTo(builder);

            builder.AppendFormat(" {0} {1} ", EventTime.ToString().ToUpperInvariant(), EventType.AsDebugString());

            builder.Append("ON ");
            TableName.AppendTo(builder);
            builder.Append(" ");

            builder.Append("FOR EACH ROW ");

            if (Status != TriggerStatus.Unknown)
            {
                if (Status == TriggerStatus.Disabled)
                {
                    builder.Append("DISABLE ");
                }
                else if (Status == TriggerStatus.Enabled)
                {
                    builder.Append("ENABLE ");
                }
            }

            builder.Append("CALL ");

            ProcedureName.AppendTo(builder);
            builder.Append("(");

            if (ProcedureArguments != null &&
                ProcedureArguments.Length > 0)
            {
                for (int i = 0; i < ProcedureArguments.Length; i++)
                {
                    ProcedureArguments[i].AppendTo(builder);

                    if (i < ProcedureArguments.Length - 1)
                    {
                        builder.Append(", ");
                    }
                }
            }

            builder.Append(")");
        }
Esempio n. 3
0
        protected override void AppendTo(SqlStringBuilder builder)
        {
            builder.Append("CREATE ");
            if (ReplaceIfExists)
            {
                builder.Append("OR REPLACE ");
            }

            builder.Append("TRIGGER ");
            TriggerName.AppendTo(builder);
            builder.Append(" ");

            builder.AppendFormat("{0} {1} ", EventTime.ToString().ToUpperInvariant(), EventType.AsDebugString());

            builder.Append("ON ");
            TableName.AppendTo(builder);

            if (Status != TriggerStatus.Unknown)
            {
                if (Status == TriggerStatus.Disabled)
                {
                    builder.Append(" DISABLE");
                }
                else if (Status == TriggerStatus.Enabled)
                {
                    builder.Append(" ENABLE");
                }
            }

            builder.AppendLine();
            builder.Indent();

            Body.AppendTo(builder);

            builder.DeIndent();
        }