DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Public Member Functions | Package Functions | Properties | Private Member Functions | List of all members
Deveel.Data.Routines.FunctionInfo Class Reference

The function signature information that are used to resolve a function within a context. More...

Inheritance diagram for Deveel.Data.Routines.FunctionInfo:
Deveel.Data.Routines.RoutineInfo Deveel.Data.Sql.IObjectInfo

Public Member Functions

 FunctionInfo (ObjectName routineName, FunctionType functionType)
 Constructs a FunctionInfo without arguments. More...
 
 FunctionInfo (ObjectName routineName, SqlType returnType)
 
 FunctionInfo (ObjectName routineName, SqlType returnType, FunctionType functionType)
 
 FunctionInfo (ObjectName routineName, RoutineParameter[] parameters)
 
 FunctionInfo (ObjectName routineName, RoutineParameter[] parameters, FunctionType functionType)
 
 FunctionInfo (ObjectName routineName, RoutineParameter[] parameters, SqlType returnType)
 
 FunctionInfo (ObjectName routineName, RoutineParameter[] parameters, SqlType returnType, FunctionType functionType)
 
- Public Member Functions inherited from Deveel.Data.Routines.RoutineInfo
override string ToString ()
 

Package Functions

override bool MatchesInvoke (Invoke request, IQuery query)
 

Properties

override RoutineType RoutineType [get]
 
SqlType ReturnType [get, private set]
 
bool HasUnboundParameter [get, set]
 
FunctionType FunctionType [get, private set]
 Gets the kind of function. More...
 
- Properties inherited from Deveel.Data.Routines.RoutineInfo
DbObjectType IObjectInfo. ObjectType [get]
 
ObjectName IObjectInfo. FullName [get]
 
ObjectName RoutineName [get, private set]
 Gets the name of the routine that uniquely identifies it in a system context. More...
 
abstract RoutineType RoutineType [get]
 
RoutineParameter[] Parameters [get, private set]
 Gets an array of parameters for the routine. More...
 
string ExternalMethodName [get, set]
 
Type ExternalType [get, set]
 
- Properties inherited from Deveel.Data.Sql.IObjectInfo
DbObjectType ObjectType [get]
 
ObjectName FullName [get]
 

Private Member Functions

void AssertUnboundAtEnd ()
 

Additional Inherited Members

- Protected Member Functions inherited from Deveel.Data.Routines.RoutineInfo
 RoutineInfo (ObjectName routineName)
 Constructs a routine info with the given name. More...
 
 RoutineInfo (ObjectName routineName, RoutineParameter[] parameters)
 Constructs the routine info with the given signature. More...
 

Detailed Description

The function signature information that are used to resolve a function within a context.

See also
RoutineInfo

Definition at line 30 of file FunctionInfo.cs.

Constructor & Destructor Documentation

Deveel.Data.Routines.FunctionInfo.FunctionInfo ( ObjectName  routineName,
FunctionType  functionType 
)
inline

Constructs a FunctionInfo without arguments.

Parameters
routineNameThe name of the function.
functionTypeThe type of function this

Definition at line 36 of file FunctionInfo.cs.

37  : this(routineName, (SqlType)null, functionType) {
38  }
Defines the properties of a specific SQL Type and handles the values compatible.
Definition: SqlType.cs:33
Deveel.Data.Routines.FunctionInfo.FunctionInfo ( ObjectName  routineName,
SqlType  returnType 
)
inline

Definition at line 40 of file FunctionInfo.cs.

41  : this(routineName, returnType, FunctionType.Static) {
42  }
FunctionType FunctionType
Gets the kind of function.
Definition: FunctionInfo.cs:96
Deveel.Data.Routines.FunctionInfo.FunctionInfo ( ObjectName  routineName,
SqlType  returnType,
FunctionType  functionType 
)
inline

Definition at line 44 of file FunctionInfo.cs.

45  : base(routineName) {
46  ReturnType = returnType;
47  FunctionType = functionType;
49  }
FunctionType FunctionType
Gets the kind of function.
Definition: FunctionInfo.cs:96
Deveel.Data.Routines.FunctionInfo.FunctionInfo ( ObjectName  routineName,
RoutineParameter[]  parameters 
)
inline

Definition at line 51 of file FunctionInfo.cs.

52  : this(routineName, parameters, FunctionType.Static) {
53  }
FunctionType FunctionType
Gets the kind of function.
Definition: FunctionInfo.cs:96
Deveel.Data.Routines.FunctionInfo.FunctionInfo ( ObjectName  routineName,
RoutineParameter[]  parameters,
FunctionType  functionType 
)
inline

Definition at line 55 of file FunctionInfo.cs.

56  : this(routineName, parameters, null, functionType) {
57  }
Deveel.Data.Routines.FunctionInfo.FunctionInfo ( ObjectName  routineName,
RoutineParameter[]  parameters,
SqlType  returnType 
)
inline

Definition at line 59 of file FunctionInfo.cs.

60  : this(routineName, parameters, returnType, FunctionType.Static) {
61  }
FunctionType FunctionType
Gets the kind of function.
Definition: FunctionInfo.cs:96
Deveel.Data.Routines.FunctionInfo.FunctionInfo ( ObjectName  routineName,
RoutineParameter[]  parameters,
SqlType  returnType,
FunctionType  functionType 
)
inline

Definition at line 63 of file FunctionInfo.cs.

64  : base(routineName, parameters) {
65  ReturnType = returnType;
66  FunctionType = functionType;
68  }
FunctionType FunctionType
Gets the kind of function.
Definition: FunctionInfo.cs:96

Member Function Documentation

void Deveel.Data.Routines.FunctionInfo.AssertUnboundAtEnd ( )
inlineprivate

Definition at line 76 of file FunctionInfo.cs.

76  {
77  for (int i = 0; i < Parameters.Length; i++) {
78  var param = Parameters[i];
79  if (param.IsUnbounded) {
81  throw new ArgumentException("Cannot specify more than one 'unbounded' argument for a function.");
82 
83  if (i != Parameters.Length - 1)
84  throw new ArgumentException("An unbounded parameter must be present only at the end.");
85 
86  HasUnboundParameter = true;
87  }
88  }
89  }
RoutineParameter[] Parameters
Gets an array of parameters for the routine.
Definition: RoutineInfo.cs:72
override bool Deveel.Data.Routines.FunctionInfo.MatchesInvoke ( Invoke  request,
IQuery  query 
)
inlinepackagevirtual

Implements Deveel.Data.Routines.RoutineInfo.

Definition at line 98 of file FunctionInfo.cs.

98  {
99  if (request == null)
100  return false;
101 
102  bool ignoreCase = true;
103  if (query != null)
104  ignoreCase = query.IgnoreIdentifiersCase();
105 
106  if (!RoutineName.Equals(request.RoutineName, ignoreCase))
107  return false;
108 
109  // TODO: add a better resolution to obtain the final type of the argument
110  // and compare it to the parameter type definition
111  bool unboundedSeen = false;
112  for (int i = 0; i < request.Arguments.Length; i++) {
113  var argType = request.Arguments[i].ReturnType(query, null);
114 
115  if (i + 1 > Parameters.Length) {
116  if (!unboundedSeen)
117  return false;
118 
119  // TODO: verify the type of the argument (how to evaluate?)
120 
121  } else {
122  var param = Parameters[i];
123  unboundedSeen = param.IsUnbounded;
124 
125  var paramType = param.Type;
126 
127  if (!paramType.IsComparable(argType))
128  return false;
129  }
130  }
131 
132  if (!unboundedSeen &&
133  request.Arguments.Length != Parameters.Length)
134  return false;
135 
136  return true;
137  }
RoutineParameter[] Parameters
Gets an array of parameters for the routine.
Definition: RoutineInfo.cs:72
override bool Equals(object obj)
Definition: ObjectName.cs:241
ObjectName RoutineName
Gets the name of the routine that uniquely identifies it in a system context.
Definition: RoutineInfo.cs:65

Property Documentation

FunctionType Deveel.Data.Routines.FunctionInfo.FunctionType
getprivate set

Gets the kind of function.

Definition at line 96 of file FunctionInfo.cs.

bool Deveel.Data.Routines.FunctionInfo.HasUnboundParameter
getsetprivate

Definition at line 91 of file FunctionInfo.cs.

SqlType Deveel.Data.Routines.FunctionInfo.ReturnType
getprivate set

Definition at line 74 of file FunctionInfo.cs.

override RoutineType Deveel.Data.Routines.FunctionInfo.RoutineType
get

Definition at line 70 of file FunctionInfo.cs.


The documentation for this class was generated from the following file: