Exemple #1
0
        public void CreateExternalFunction()
        {
            var funName    = ObjectName.Parse("APP.fun1");
            var parameters = new RoutineParameter[] {
                new RoutineParameter("a", PrimitiveTypes.Integer()),
                new RoutineParameter("b", PrimitiveTypes.Integer()),
            };

            var externRef = ExternalRef.MakeRef(typeof(Test), "Function(int, int)");

            AdminQuery.CreateExternFunction(funName, PrimitiveTypes.Integer(), parameters, externRef.ToString());

            var exists = AdminQuery.Access().RoutineExists(funName);

            Assert.IsTrue(exists);

            var function = AdminQuery.Access().GetObject(DbObjectType.Routine, funName);

            Assert.IsNotNull(function);
            Assert.IsInstanceOf <ExternalFunction>(function);

            var externFunction = (ExternalFunction)function;

            Assert.IsNotNull(externFunction.ExternalRef);
            Assert.AreEqual(typeof(Test), externFunction.ExternalRef.Type);
        }
        public void CreateExternalProcedure()
        {
            var procName   = ObjectName.Parse("APP.proc1");
            var parameters = new RoutineParameter[] {
                new RoutineParameter("a", PrimitiveTypes.Integer()),
                new RoutineParameter("b", PrimitiveTypes.Integer()),
            };

            var externRef = ExternalRef.MakeRef(typeof(Test), "Procedure(int, int)");

            AdminQuery.CreateExternProcedure(procName, parameters, externRef.ToString());

            var exists = AdminQuery.Access().RoutineExists(procName);

            Assert.IsTrue(exists);

            var procedure = AdminQuery.Access().GetObject(DbObjectType.Routine, procName);

            Assert.IsNotNull(procedure);
            Assert.IsInstanceOf <ExternalProcedure>(procedure);

            var externFunction = (ExternalProcedure)procedure;

            Assert.IsNotNull(externFunction.ExternalRef);
            Assert.AreEqual(typeof(Test), externFunction.ExternalRef.Type);
        }
        private void CreateExternProc1(IQuery query)
        {
            var procName = ObjectName.Parse("APP.extProc");
            var args     = new[] {
                new RoutineParameter("a", PrimitiveTypes.String()),
                new RoutineParameter("b", PrimitiveTypes.String(), ParameterDirection.Output)
            };

            var externRef = ExternalRef.MakeRef(typeof(TestClass), "Procedure(string, string)");
            var procInfo  = new ExternalProcedureInfo(procName, args, externRef);

            query.Access().CreateObject(procInfo);
        }