Example #1
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(")");
        }
        void ISqlFormattable.AppendTo(SqlStringBuilder builder)
        {
            if (IsTable)
            {
                TableName.AppendTo(builder);
            }
            else
            {
                builder.Append("(");
                Query.AppendTo(builder);
                builder.Append(")");
            }

            if (IsAliased)
            {
                builder.AppendFormat(" AS {0}", Alias);
            }
        }
Example #3
0
        protected override void AppendTo(SqlStringBuilder builder)
        {
            builder.Append("LOCK TABLE ");
            TableName.AppendTo(builder);
            builder.AppendFormat(" IN {0} MODE", Mode.ToString().ToUpperInvariant());

            if (WaitTimeout >= 0)
            {
                if (WaitTimeout == 0)
                {
                    builder.Append(" NOWAIT");
                }
                else
                {
                    builder.AppendFormat(" WAIT {0}", WaitTimeout);
                }
            }
        }
Example #4
0
        void ISqlFormattable.AppendTo(SqlStringBuilder builder)
        {
            TableName.AppendTo(builder);
            builder.AppendLine(" (");
            builder.Indent();

            for (int i = 0; i < Columns.Count; i++)
            {
                Columns[i].AppendTo(builder);

                if (i < Columns.Count - 1)
                {
                    builder.Append(",");
                }

                builder.AppendLine();
            }

            builder.DeIndent();
            builder.Append(")");
        }
Example #5
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();
        }
        void ISqlFormattable.AppendTo(SqlStringBuilder builder)
        {
            if (IsGlob)
            {
                if (IsAll)
                {
                    builder.Append("*");
                }
                else
                {
                    TableName.AppendTo(builder);
                    builder.Append(".*");
                }
            }
            else
            {
                Expression.AppendTo(builder);
            }

            if (!String.IsNullOrEmpty(Alias))
            {
                builder.AppendFormat(" AS {0}", Alias);
            }
        }