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

The information about the invocation of a routine, including the full name and arguments (as SqlExpression). More...

Public Member Functions

 Invoke (ObjectName routineName)
 Constructs a new Invoke with the given name of the routine and no arguments. More...
 
 Invoke (ObjectName routineName, SqlExpression[] arguments)
 Constructs a new Invoke with the given name of the routine and the arguments. More...
 
bool IsAggregate (IRequest query)
 Checks if the target of the invocation is an aggregate function. More...
 
IRoutine ResolveRoutine (IRequest context)
 Resolves the routine target of the invocation within the give context. More...
 
IFunction ResolveFunction (IQuery context)
 
IProcedure ResolveProcedure (IQuery context)
 
IFunction ResolveSystemFunction ()
 Resolves this routine invocation to a system function. More...
 
InvokeResult Execute ()
 
InvokeResult Execute (IRequest query)
 
InvokeResult Execute (IRequest query, IVariableResolver resolver)
 
InvokeResult Execute (IRequest query, IVariableResolver resolver, IGroupResolver group)
 
override String ToString ()
 

Properties

ObjectName RoutineName [get, private set]
 Gets the fully qualified name of the routine to invoke. More...
 
SqlExpression[] Arguments [get, private set]
 Gets an array of arguments to be passed to the invoked routine. More...
 
bool IsGlobArgument [get]
 Gets a boolean value indicating if the arguments of the invocation represent a single glob (*). More...
 

Private Attributes

IRoutine cached
 

Detailed Description

The information about the invocation of a routine, including the full name and arguments (as SqlExpression).

Definition at line 30 of file Invoke.cs.

Constructor & Destructor Documentation

Deveel.Data.Routines.Invoke.Invoke ( ObjectName  routineName)
inline

Constructs a new Invoke with the given name of the routine and no arguments.

Parameters
routineNameThe fully qualified name of the routine to be invoked.

Definition at line 39 of file Invoke.cs.

40  : this(routineName, new SqlExpression[0]) {
41  }
Defines the base class for instances that represent SQL expression tree nodes.
Deveel.Data.Routines.Invoke.Invoke ( ObjectName  routineName,
SqlExpression[]  arguments 
)
inline

Constructs a new Invoke with the given name of the routine and the arguments.

Parameters
routineNameThe fully qualified name of the routine to be invoked.
argumentsThe arguments to pass to the routine.

Definition at line 50 of file Invoke.cs.

50  {
51  RoutineName = routineName;
52  Arguments = arguments;
53  }
SqlExpression[] Arguments
Gets an array of arguments to be passed to the invoked routine.
Definition: Invoke.cs:63
ObjectName RoutineName
Gets the fully qualified name of the routine to invoke.
Definition: Invoke.cs:58

Member Function Documentation

InvokeResult Deveel.Data.Routines.Invoke.Execute ( )
inline

Definition at line 151 of file Invoke.cs.

151  {
152  return Execute(null);
153  }
InvokeResult Execute()
Definition: Invoke.cs:151
InvokeResult Deveel.Data.Routines.Invoke.Execute ( IRequest  query)
inline

Definition at line 155 of file Invoke.cs.

155  {
156  return Execute(query, null);
157  }
InvokeResult Execute()
Definition: Invoke.cs:151
InvokeResult Deveel.Data.Routines.Invoke.Execute ( IRequest  query,
IVariableResolver  resolver 
)
inline

Definition at line 159 of file Invoke.cs.

159  {
160  return Execute(query, resolver, null);
161  }
InvokeResult Execute()
Definition: Invoke.cs:151
InvokeResult Deveel.Data.Routines.Invoke.Execute ( IRequest  query,
IVariableResolver  resolver,
IGroupResolver  group 
)
inline

Definition at line 163 of file Invoke.cs.

163  {
164  var routine = ResolveRoutine(query);
165  var executeContext = new InvokeContext(this, routine, resolver, group, query);
166  return routine.Execute(executeContext);
167  }
IRoutine ResolveRoutine(IRequest context)
Resolves the routine target of the invocation within the give context.
Definition: Invoke.cs:115
bool Deveel.Data.Routines.Invoke.IsAggregate ( IRequest  query)
inline

Checks if the target of the invocation is an aggregate function.

Parameters
queryThe query context used to resolve the routine.
Returns
Returns true if the target routine of the invocation is a IFunction and the IFunction.FunctionType is FunctionType.Aggregate, otherwise it returns false.

Definition at line 91 of file Invoke.cs.

91  {
92  if (query.Query.IsAggregateFunction(this))
93  return true;
94 
95  // Look at parameterss
96  return Arguments.Any(x => x.HasAggregate(query));
97  }
SqlExpression[] Arguments
Gets an array of arguments to be passed to the invoked routine.
Definition: Invoke.cs:63
static SqlBinaryExpression Any(SqlExpression left, SqlExpressionType anyType, SqlExpression right)
IFunction Deveel.Data.Routines.Invoke.ResolveFunction ( IQuery  context)
inline

Definition at line 131 of file Invoke.cs.

131  {
132  return ResolveRoutine(context) as IFunction;
133  }
IRoutine ResolveRoutine(IRequest context)
Resolves the routine target of the invocation within the give context.
Definition: Invoke.cs:115
IProcedure Deveel.Data.Routines.Invoke.ResolveProcedure ( IQuery  context)
inline

Definition at line 135 of file Invoke.cs.

135  {
136  return ResolveRoutine(context) as IProcedure;
137  }
IRoutine ResolveRoutine(IRequest context)
Resolves the routine target of the invocation within the give context.
Definition: Invoke.cs:115
IRoutine Deveel.Data.Routines.Invoke.ResolveRoutine ( IRequest  context)
inline

Resolves the routine target of the invocation within the give context.

Parameters
contextThe query context used to resolve the routine.

If the given context is null this method will try to resolve the routine towards the

Returns
Returns an instance of IRoutine that is the target of the invocation.
Exceptions
InvalidOperationExceptionIf the routine could not be resolved for this call.

Definition at line 115 of file Invoke.cs.

115  {
116  if (cached != null)
117  return cached;
118 
119  if (context == null) {
120  cached = SystemFunctions.Provider.ResolveFunction(this, null);
121  } else {
122  cached = context.Query.ResolveRoutine(this);
123  }
124 
125  if (cached == null)
126  throw new InvalidOperationException(String.Format("Unable to resolve the call {0} to a function", this));
127 
128  return cached;
129  }
A long string in the system.
IFunction Deveel.Data.Routines.Invoke.ResolveSystemFunction ( )
inline

Resolves this routine invocation to a system function.

Returns
Returns an instance of IFunction that is defined in the SystemFunctions domain.
See also
ResolveRoutine

Definition at line 147 of file Invoke.cs.

147  {
148  return ResolveRoutine(null) as IFunction;
149  }
IRoutine ResolveRoutine(IRequest context)
Resolves the routine target of the invocation within the give context.
Definition: Invoke.cs:115
override String Deveel.Data.Routines.Invoke.ToString ( )
inline

Definition at line 169 of file Invoke.cs.

169  {
170  var buf = new StringBuilder();
171  buf.Append(RoutineName);
172  buf.Append('(');
173  for (int i = 0; i < Arguments.Length; ++i) {
174  buf.Append(Arguments[i]);
175  if (i < Arguments.Length - 1) {
176  buf.Append(',');
177  }
178  }
179  buf.Append(')');
180  return buf.ToString();
181  }
SqlExpression[] Arguments
Gets an array of arguments to be passed to the invoked routine.
Definition: Invoke.cs:63
ObjectName RoutineName
Gets the fully qualified name of the routine to invoke.
Definition: Invoke.cs:58

Member Data Documentation

IRoutine Deveel.Data.Routines.Invoke.cached
private

Definition at line 31 of file Invoke.cs.

Property Documentation

SqlExpression [] Deveel.Data.Routines.Invoke.Arguments
getprivate set

Gets an array of arguments to be passed to the invoked routine.

Definition at line 63 of file Invoke.cs.

bool Deveel.Data.Routines.Invoke.IsGlobArgument
get

Gets a boolean value indicating if the arguments of the invocation represent a single glob (*).

The glob argument is a special one and it is used for functions like COUNT.

Definition at line 73 of file Invoke.cs.

ObjectName Deveel.Data.Routines.Invoke.RoutineName
getprivate set

Gets the fully qualified name of the routine to invoke.

Definition at line 58 of file Invoke.cs.


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