Пример #1
0
        protected virtual SqlStatement VisitCreateProcedure(CreateProcedureStatement statement)
        {
            var body = statement.Body;

            if (body != null)
            {
                // TODO: Maybe the body should be generic to support this model
                body = (PlSqlBlockStatement)VisitStatement(body);
            }

            return(new CreateProcedureStatement(statement.ProcedureName, statement.Parameters, body)
            {
                ReplaceIfExists = statement.ReplaceIfExists
            });
        }
        public static void WithArguments()
        {
            var body = new PlSqlBlockStatement();
            body.Statements.Add(new AssignVariableStatement(SqlExpression.VariableReference("a"), SqlExpression.Constant(3)));
            var statement = new CreateProcedureStatement(ObjectName.Parse("SYS.proc1"), new[] {
                new RoutineParameter("a", PrimitiveTypes.Integer()),
            }, body);

            var sql = statement.ToString();
            var expected = new SqlStringBuilder();
            expected.AppendLine("CREATE PROCEDURE SYS.proc1(a INTEGER IN NOT NULL) IS");
            expected.AppendLine("  BEGIN");
            expected.AppendLine("    :a := 3");
            expected.Append("  END");

            Assert.AreEqual(expected.ToString(), sql);
        }
        public static void WithArguments()
        {
            var body = new PlSqlBlockStatement();

            body.Statements.Add(new AssignVariableStatement(SqlExpression.VariableReference("a"), SqlExpression.Constant(3)));
            var statement = new CreateProcedureStatement(ObjectName.Parse("SYS.proc1"), new[] {
                new RoutineParameter("a", PrimitiveTypes.Integer()),
            }, body);

            var sql      = statement.ToString();
            var expected = new SqlStringBuilder();

            expected.AppendLine("CREATE PROCEDURE SYS.proc1(a INTEGER IN NOT NULL) IS");
            expected.AppendLine("  BEGIN");
            expected.AppendLine("    :a := 3");
            expected.Append("  END");

            Assert.AreEqual(expected.ToString(), sql);
        }
Пример #4
0
        protected virtual SqlStatement VisitCreateProcedure(CreateProcedureStatement statement)
        {
            var body = statement.Body;
            if (body != null)
                // TODO: Maybe the body should be generic to support this model
                body = (PlSqlBlockStatement)VisitStatement(body);

            return new CreateProcedureStatement(statement.ProcedureName, statement.Parameters, body) {
                ReplaceIfExists = statement.ReplaceIfExists
            };
        }