public FunctionInfo(ObjectName routineName, RoutineParameter[] parameters, DataType returnType, FunctionType functionType) : base(routineName, parameters) { ReturnType = returnType; FunctionType = functionType; AssertUnboundAtEnd(); }
public PlSqlProcedureInfo(ObjectName procedureName, RoutineParameter[] parameters, SqlStatement body) : base(procedureName, parameters) { if (body == null) throw new ArgumentNullException("body"); Body = body; }
public ExternalProcedureInfo(ObjectName procedureName, RoutineParameter[] parameters, ExternalRef externalRef) : base(procedureName, parameters) { if (externalRef == null) throw new ArgumentNullException("externalRef"); ExternalRef = externalRef; }
public ExternalFunctionInfo(ObjectName functionName, RoutineParameter[] parameters, SqlType returnType, ExternalRef externalRef) : base(functionName, parameters, returnType, FunctionType.Static) { if (externalRef == null) throw new ArgumentNullException("externalRef"); ExternalRef = externalRef; }
public CreateProcedureStatement(ObjectName procedureName, RoutineParameter[] parameters, SqlStatement body) { if (procedureName == null) throw new ArgumentNullException("procedureName"); if (body == null) throw new ArgumentNullException("body"); ProcedureName = procedureName; Parameters = parameters; Body = body; }
public CreateExternalProcedureStatement(ObjectName procedureName, RoutineParameter[] parameters, string externalRef) { if (procedureName == null) throw new ArgumentNullException("procedureName"); if (String.IsNullOrEmpty(externalRef)) throw new ArgumentNullException("externalRef"); ProcedureName = procedureName; Parameters = parameters; ExternalReference = externalRef; }
/// <summary> /// Constructs the routine info with the given signature. /// </summary> /// <param name="routineName">The name uniquely identifying the routine.</param> /// <param name="parameters">The list of parameter information of the routine.</param> protected RoutineInfo(ObjectName routineName, RoutineParameter[] parameters) { if (routineName == null) throw new ArgumentNullException("routineName"); if (parameters == null) parameters = new RoutineParameter[0]; RoutineName = routineName; Parameters = parameters; Body = new RoutineBody(this); }
public CreateFunctionStatement(ObjectName functionName, SqlType returnType, RoutineParameter[] parameters, SqlStatement body) { if (functionName == null) throw new ArgumentNullException("functionName"); if (returnType == null) throw new ArgumentNullException("returnType"); if (body == null) throw new ArgumentNullException("body"); FunctionName = functionName; ReturnType = returnType; Parameters = parameters; Body = body; }
public CreateExternalFunctionStatement(ObjectName functionName, SqlType returnType, RoutineParameter[] parameters, string externalRef) { if (functionName == null) throw new ArgumentNullException("functionName"); if (returnType == null) throw new ArgumentNullException("returnType"); if (String.IsNullOrEmpty(externalRef)) throw new ArgumentNullException("externalRef"); FunctionName = functionName; ReturnType = returnType; Parameters = parameters; ExternalReference = externalRef; }
public PlSqlFunctionInfo(ObjectName functionName, RoutineParameter[] parameters, SqlType returnType, SqlStatement body) : base(functionName, parameters,returnType, FunctionType.Static) { if (body == null) throw new ArgumentNullException("body"); // TODO: in case of RETURNS TABLE verify a select is there if (!(returnType is TabularType)) { if (!ReturnChecker.HasReturn(body)) throw new ArgumentException("The function body has no return"); } Body = body; }
/// <summary> /// Constructs the routine info with the given signature. /// </summary> /// <param name="routineName">The name uniquely identifying the routine.</param> /// <param name="parameters">The list of parameter information of the routine.</param> protected RoutineInfo(ObjectName routineName, RoutineParameter[] parameters) { if (routineName == null) { throw new ArgumentNullException("routineName"); } if (parameters == null) { parameters = new RoutineParameter[0]; } RoutineName = routineName; Parameters = parameters; // TODO: Body = new RoutineBody(this); }
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); }
protected override void ExecuteStatement(ExecutionContext context) { //if (!context.User.CanCreateInSchema(ProcedureName.ParentName)) // throw new SecurityException(); if (context.DirectAccess.RoutineExists(ProcedureName)) { if (!ReplaceIfExists) throw new StatementException(String.Format("A routine named '{0}' already exists in the database.", ProcedureName)); context.DirectAccess.DeleteRoutine(ProcedureName); } var parameters = new RoutineParameter[0]; if (Parameters != null) parameters = Parameters.ToArray(); ExternalRef externRef; if (!ExternalRef.TryParse(ExternalReference, out externRef)) throw new FormatException(String.Format("The external reference '{0}' is not valid.", ExternalReference)); var functionInfo = new ExternalProcedureInfo(ProcedureName, parameters, externRef) { Owner = context.User.Name }; context.DirectAccess.CreateRoutine(functionInfo); //context.DirectAccess.GrantOn(DbObjectType.Routine, ProcedureName, context.User.Name, Privileges.Execute, true); }
protected AggregateFunction(ObjectName name, RoutineParameter[] parameters, SqlType returnType) : base(name, parameters, returnType, FunctionType.Aggregate) { }
public ProcedureInfo(ObjectName routineName, RoutineParameter[] parameters) : this(routineName, ProcedureType.Static, parameters) { }
public FunctionInfo(ObjectName routineName, RoutineParameter[] parameters) : this(routineName, parameters, FunctionType.Static) { }
protected override void ExecuteStatement(ExecutionContext context) { //if (!context.User.CanCreateInSchema(FunctionName.ParentName)) // throw new SecurityException(); if (context.DirectAccess.RoutineExists(FunctionName)) { if (!ReplaceIfExists) throw new StatementException(String.Format("A routine named '{0}' already exists in the database.", FunctionName)); context.DirectAccess.DeleteRoutine(FunctionName); } var parameters = new RoutineParameter[0]; if (Parameters != null) parameters = Parameters.ToArray(); var functionInfo = new PlSqlFunctionInfo(FunctionName, parameters, ReturnType, Body) { Owner = context.User.Name }; context.DirectAccess.CreateRoutine(functionInfo); //context.DirectAccess.GrantOn(DbObjectType.Routine, FunctionName, context.User.Name, Privileges.Execute, true); }
public FunctionInfo(ObjectName routineName, RoutineParameter[] parameters, FunctionType functionType) : this(routineName, parameters, null, functionType) { }
public UserFunction(ObjectName name, RoutineParameter[] parameters, DataType returnType) : base(name, parameters, returnType) { }
public SystemFunctionInfo(string functionName, RoutineParameter[] parameters, SqlType returnType, FunctionType functionType) : base(new ObjectName(functionName), parameters, returnType, functionType) { }
public SystemFunctionInfo(string functionName, RoutineParameter[] parameters, FunctionType functionType) : this(functionName, parameters, null, functionType) { }
public UserFunction(ObjectName name, RoutineParameter[] parameters, FunctionType functionType) : base(name, parameters, functionType) { }
public UserFunction(ObjectName name, RoutineParameter[] parameters, SqlType returnType, FunctionType functionType) : base(name, parameters, returnType, functionType) { }
protected Function(ObjectName name, RoutineParameter[] parameters, FunctionType functionType) : this(name, parameters, null, functionType) { }
public ProcedureInfo(ObjectName routineName, ProcedureType procedureType, RoutineParameter[] parameters) : base(routineName, parameters) { ProcedureType = procedureType; }
protected Function(ObjectName name, RoutineParameter[] parameters, SqlType returnType) : this(name, parameters, returnType, FunctionType.Static) { }
protected Function(ObjectName name, RoutineParameter[] parameters, SqlType returnType, FunctionType functionType) : this(new FunctionInfo(name, parameters, returnType, functionType)) { }
private SystemFunctionInfo CreateFunctionInfo(ObjectName typeName, IDictionary<string, SqlType> members) { var parameters = new RoutineParameter[members.Count]; int i = -1; foreach (var member in members) { parameters[++i] = new RoutineParameter(member.Key, member.Value, ParameterDirection.Input); } return new SystemFunctionInfo(typeName.FullName, parameters, FunctionType.Static); }
protected SystemFunction(string name, RoutineParameter[] parameters, SqlType returnType, FunctionType functionType) : this(new SystemFunctionInfo(name, parameters, returnType, functionType)) { }
public FunctionInfo(ObjectName routineName, RoutineParameter[] parameters, DataType returnType) : this(routineName, parameters, returnType, FunctionType.Static) { }