public static void ProcedureTrigger_NoArguments()
        {
            var statement = new CreateProcedureTriggerStatement(ObjectName.Parse("APP.trig1"), new ObjectName("tab1"),
                ObjectName.Parse("APP.proc1"), TriggerEventTime.After, TriggerEventType.Delete);

            var expected = "CREATE TRIGGER APP.trig1 AFTER DELETE ON tab1 FOR EACH ROW CALL APP.proc1()";

            Assert.AreEqual(expected, statement.ToString());
        }
Ejemplo n.º 2
0
        public static void ProcedureTrigger_NoArguments()
        {
            var statement = new CreateProcedureTriggerStatement(ObjectName.Parse("APP.trig1"), new ObjectName("tab1"),
                                                                ObjectName.Parse("APP.proc1"), TriggerEventTime.After, TriggerEventType.Delete);

            var expected = "CREATE TRIGGER APP.trig1 AFTER DELETE ON tab1 FOR EACH ROW CALL APP.proc1()";

            Assert.AreEqual(expected, statement.ToString());
        }
        public static void ProcedureTrigger_WithArguments()
        {
            var args = new InvokeArgument[] {
                new InvokeArgument("a", SqlExpression.Constant(3))
            };

            var statement = new CreateProcedureTriggerStatement(ObjectName.Parse("APP.trig1"), new ObjectName("tab1"),
                ObjectName.Parse("APP.proc1"), args, TriggerEventTime.After, TriggerEventType.Delete) {
                    ReplaceIfExists = true,
                    Status = TriggerStatus.Enabled
                };

            var expected = "CREATE OR REPLACE TRIGGER APP.trig1 AFTER DELETE ON tab1 FOR EACH ROW ENABLE CALL APP.proc1(a => 3)";

            Assert.AreEqual(expected, statement.ToString());
        }
Ejemplo n.º 4
0
        public static void ProcedureTrigger_WithArguments()
        {
            var args = new InvokeArgument[] {
                new InvokeArgument("a", SqlExpression.Constant(3))
            };

            var statement = new CreateProcedureTriggerStatement(ObjectName.Parse("APP.trig1"), new ObjectName("tab1"),
                                                                ObjectName.Parse("APP.proc1"), args, TriggerEventTime.After, TriggerEventType.Delete)
            {
                ReplaceIfExists = true,
                Status          = TriggerStatus.Enabled
            };

            var expected = "CREATE OR REPLACE TRIGGER APP.trig1 AFTER DELETE ON tab1 FOR EACH ROW ENABLE CALL APP.proc1(a => 3)";

            Assert.AreEqual(expected, statement.ToString());
        }
Ejemplo n.º 5
0
 protected override SqlStatement VisitCreateProcedureTrigger(CreateProcedureTriggerStatement statement)
 {
     return(base.VisitCreateProcedureTrigger(statement));
 }
Ejemplo n.º 6
0
 protected virtual SqlStatement VisitCreateProcedureTrigger(CreateProcedureTriggerStatement statement)
 {
     return new CreateProcedureTriggerStatement(statement.TriggerName, statement.TableName, statement.ProcedureName,
         statement.ProcedureArguments, statement.EventTime, statement.EventType);
 }
Ejemplo n.º 7
0
        public void CreateProcedureTrigger()
        {
            var procName = ObjectName.Parse("APP.proc1");
            var args = new InvokeArgument[] {
                new InvokeArgument(SqlExpression.Constant(2)),
            };
            var statement = new CreateProcedureTriggerStatement(ObjectName.Parse("APP.trig1"), new ObjectName("tab1"), procName, args,
                TriggerEventTime.Before, TriggerEventType.Insert | TriggerEventType.Update);

            SerializeAndAssert(statement, (serialized, deserialized) => {
                Assert.IsNotNull(deserialized);
                Assert.IsNotNull(deserialized.TriggerName);
                Assert.IsNotNull(deserialized.TableName);
                Assert.IsNotNull(deserialized.ProcedureArguments);
                Assert.AreEqual("APP.trig1", deserialized.TriggerName.FullName);
                Assert.AreEqual("tab1", deserialized.TableName.FullName);
                Assert.AreEqual(TriggerEventTime.Before, deserialized.EventTime);
            });
        }
Ejemplo n.º 8
0
 protected override SqlStatement VisitCreateProcedureTrigger(CreateProcedureTriggerStatement statement)
 {
     return base.VisitCreateProcedureTrigger(statement);
 }
Ejemplo n.º 9
0
 protected virtual SqlStatement VisitCreateProcedureTrigger(CreateProcedureTriggerStatement statement)
 {
     return(new CreateProcedureTriggerStatement(statement.TriggerName, statement.TableName, statement.ProcedureName,
                                                statement.ProcedureArguments, statement.EventTime, statement.EventType));
 }