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

Static Public Member Functions

static bool IsSystemFunction (this IQueryContext context, Invoke invoke)
 
static bool IsAggregateFunction (this IQueryContext context, Invoke invoke)
 
static IRoutine ResolveRoutine (this IQueryContext context, Invoke invoke)
 
static IRoutine ResolveSystemRoutine (this IQueryContext context, Invoke invoke)
 
static IRoutine ResolveUserRoutine (this IQueryContext context, Invoke invoke)
 
static IFunction ResolveFunction (this IQueryContext context, Invoke invoke)
 
static IFunction ResolveFunction (this IQueryContext context, ObjectName functionName, params SqlExpression[] args)
 
static FunctionInfo ResolveFunctionInfo (this IQueryContext context, Invoke invoke)
 
static RoutineInfo ResolveRoutineInfo (this IQueryContext context, Invoke invoke)
 
static DataObject InvokeSystemFunction (this IQueryContext context, string functionName, params SqlExpression[] args)
 
static DataObject InvokeFunction (this IQueryContext context, Invoke invoke)
 
static DataObject InvokeFunction (this IQueryContext context, ObjectName functionName, params SqlExpression[] args)
 
static void SetReturn (this IQueryContext context, SqlExpression expression)
 

Detailed Description

Definition at line 26 of file QueryContextExtensions.cs.

Member Function Documentation

static DataObject Deveel.Data.Routines.QueryContextExtensions.InvokeFunction ( this IQueryContext  context,
Invoke  invoke 
)
inlinestatic

Definition at line 99 of file QueryContextExtensions.cs.

99  {
100  var result = invoke.Execute(context);
101  return result.ReturnValue;
102  }
static DataObject Deveel.Data.Routines.QueryContextExtensions.InvokeFunction ( this IQueryContext  context,
ObjectName  functionName,
params SqlExpression[]  args 
)
inlinestatic

Definition at line 104 of file QueryContextExtensions.cs.

105  {
106  return context.InvokeFunction(new Invoke(functionName, args));
107  }
static DataObject Deveel.Data.Routines.QueryContextExtensions.InvokeSystemFunction ( this IQueryContext  context,
string  functionName,
params SqlExpression[]  args 
)
inlinestatic

Definition at line 92 of file QueryContextExtensions.cs.

93  {
94  var resolvedName = new ObjectName(SystemSchema.SchemaName, functionName);
95  var invoke = new Invoke(resolvedName, args);
96  return context.InvokeFunction(invoke);
97  }
Describes the name of an object within a database.
Definition: ObjectName.cs:44
static readonly ObjectName SchemaName
The name of the system schema as ObjectName.
Provides utilities and properties for handling the SYSTEN schema of a database.
Definition: SystemSchema.cs:37
static bool Deveel.Data.Routines.QueryContextExtensions.IsAggregateFunction ( this IQueryContext  context,
Invoke  invoke 
)
inlinestatic

Definition at line 36 of file QueryContextExtensions.cs.

36  {
37  var function = context.ResolveFunction(invoke);
38  return function != null && function.FunctionType == FunctionType.Aggregate;
39  }
FunctionType
The different type of a function.
Definition: FunctionType.cs:25
static bool Deveel.Data.Routines.QueryContextExtensions.IsSystemFunction ( this IQueryContext  context,
Invoke  invoke 
)
inlinestatic

Definition at line 27 of file QueryContextExtensions.cs.

27  {
28  var info = context.ResolveFunctionInfo(invoke);
29  if (info == null)
30  return false;
31 
32  return info.FunctionType != FunctionType.External &&
33  info.FunctionType != FunctionType.UserDefined;
34  }
FunctionType
The different type of a function.
Definition: FunctionType.cs:25
static IFunction Deveel.Data.Routines.QueryContextExtensions.ResolveFunction ( this IQueryContext  context,
Invoke  invoke 
)
inlinestatic

Definition at line 71 of file QueryContextExtensions.cs.

71  {
72  return context.ResolveRoutine(invoke) as IFunction;
73  }
static IFunction Deveel.Data.Routines.QueryContextExtensions.ResolveFunction ( this IQueryContext  context,
ObjectName  functionName,
params SqlExpression[]  args 
)
inlinestatic

Definition at line 75 of file QueryContextExtensions.cs.

75  {
76  var invoke = new Invoke(functionName, args);
77  return context.ResolveFunction(invoke);
78  }
static FunctionInfo Deveel.Data.Routines.QueryContextExtensions.ResolveFunctionInfo ( this IQueryContext  context,
Invoke  invoke 
)
inlinestatic

Definition at line 80 of file QueryContextExtensions.cs.

80  {
81  return context.ResolveRoutineInfo(invoke) as FunctionInfo;
82  }
static IRoutine Deveel.Data.Routines.QueryContextExtensions.ResolveRoutine ( this IQueryContext  context,
Invoke  invoke 
)
inlinestatic

Definition at line 41 of file QueryContextExtensions.cs.

41  {
42  var routine = context.ResolveSystemRoutine(invoke);
43  if (routine == null)
44  routine = context.ResolveUserRoutine(invoke);
45 
46  return routine;
47  }
static RoutineInfo Deveel.Data.Routines.QueryContextExtensions.ResolveRoutineInfo ( this IQueryContext  context,
Invoke  invoke 
)
inlinestatic

Definition at line 84 of file QueryContextExtensions.cs.

84  {
85  var routine = context.ResolveRoutine(invoke);
86  if (routine == null)
87  return null;
88 
89  return routine.RoutineInfo;
90  }
static IRoutine Deveel.Data.Routines.QueryContextExtensions.ResolveSystemRoutine ( this IQueryContext  context,
Invoke  invoke 
)
inlinestatic

Definition at line 49 of file QueryContextExtensions.cs.

49  {
50  // return context.SystemContext().ResolveRoutine(invoke, context);
51 
52  var resolvers = context.ResolveAllServices<IRoutineResolver>();
53  foreach (var resolver in resolvers) {
54  var routine = resolver.ResolveRoutine(invoke, context);
55  if (routine != null)
56  return routine;
57  }
58 
59  return null;
60  }
static IRoutine Deveel.Data.Routines.QueryContextExtensions.ResolveUserRoutine ( this IQueryContext  context,
Invoke  invoke 
)
inlinestatic

Definition at line 62 of file QueryContextExtensions.cs.

62  {
63  var routine = context.Session().ResolveRoutine(invoke);
64  if (routine != null &&
65  !context.UserCanExecute(routine.Type, invoke))
66  throw new InvalidOperationException();
67 
68  return routine;
69  }
static void Deveel.Data.Routines.QueryContextExtensions.SetReturn ( this IQueryContext  context,
SqlExpression  expression 
)
inlinestatic

Definition at line 109 of file QueryContextExtensions.cs.

109  {
110  var functionContext = context as IFunctionQueryContext;
111  if (functionContext == null)
112  throw new InvalidOperationException("Not in a FUNCTION scope.");
113 
114  functionContext.SetReturn(expression);
115  }

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