24 namespace Deveel.Data.Routines {
37 : this(routineName, (
SqlType)null, functionType) {
46 ReturnType = returnType;
56 : this(routineName, parameters, null, functionType) {
64 : base(routineName, parameters) {
65 ReturnType = returnType;
74 public SqlType ReturnType {
get;
private set; }
77 for (
int i = 0; i < Parameters.Length; i++) {
78 var param = Parameters[i];
79 if (param.IsUnbounded) {
80 if (HasUnboundParameter)
81 throw new ArgumentException(
"Cannot specify more than one 'unbounded' argument for a function.");
83 if (i != Parameters.Length - 1)
84 throw new ArgumentException(
"An unbounded parameter must be present only at the end.");
86 HasUnboundParameter =
true;
91 private bool HasUnboundParameter {
get; set; }
102 bool ignoreCase =
true;
104 ignoreCase = query.IgnoreIdentifiersCase();
106 if (!RoutineName.Equals(request.
RoutineName, ignoreCase))
111 bool unboundedSeen =
false;
112 for (
int i = 0; i < request.
Arguments.Length; i++) {
113 var argType = request.
Arguments[i].ReturnType(query, null);
115 if (i + 1 > Parameters.Length) {
122 var param = Parameters[i];
123 unboundedSeen = param.IsUnbounded;
125 var paramType = param.Type;
127 if (!paramType.IsComparable(argType))
132 if (!unboundedSeen &&
133 request.
Arguments.Length != Parameters.Length)
SqlExpression[] Arguments
Gets an array of arguments to be passed to the invoked routine.
FunctionInfo(ObjectName routineName, RoutineParameter[] parameters)
void AssertUnboundAtEnd()
FunctionInfo(ObjectName routineName, RoutineParameter[] parameters, SqlType returnType, FunctionType functionType)
FunctionInfo(ObjectName routineName, RoutineParameter[] parameters, SqlType returnType)
FunctionInfo(ObjectName routineName, FunctionType functionType)
Constructs a FunctionInfo without arguments.
Describes the name of an object within a database.
A type that represents a static function.
RoutineType
The type of routine program.
The information about the invocation of a routine, including the full name and arguments (as SqlExpre...
FunctionType
The different type of a function.
Defines the properties of a specific SQL Type and handles the values compatible.
The function signature information that are used to resolve a function within a context.
ObjectName RoutineName
Gets the fully qualified name of the routine to invoke.
Defines the metadata for a routine that are used to resolve within a context.
FunctionInfo(ObjectName routineName, RoutineParameter[] parameters, FunctionType functionType)
FunctionInfo(ObjectName routineName, SqlType returnType, FunctionType functionType)
FunctionInfo(ObjectName routineName, SqlType returnType)
override bool MatchesInvoke(Invoke request, IQuery query)