DeveelDB  20151217
complete SQL database system, primarly developed for .NET/Mono frameworks
Classes | Protected Member Functions | Properties | Private Member Functions | Static Private Member Functions | List of all members
Deveel.Data.Routines.SystemFunctionsProvider Class Reference
Inheritance diagram for Deveel.Data.Routines.SystemFunctionsProvider:
Deveel.Data.Routines.FunctionProvider Deveel.Data.Routines.IRoutineResolver Deveel.Data.Sql.Fluid.IConfigurationContext

Classes

class  Cast
 
class  Count
 
class  DistinctCount
 

Protected Member Functions

override ObjectName NormalizeName (ObjectName functionName)
 
override void OnInit ()
 
- Protected Member Functions inherited from Deveel.Data.Routines.FunctionProvider
 FunctionProvider ()
 
void Register (FunctionInfo functionInfo, Func< InvokeContext, InvokeResult > body, Func< InvokeContext, SqlType > returnType)
 
void Register (Func< IFunctionConfiguration, IFunctionConfiguration > config)
 
void Register (IFunction function)
 
virtual void Dispose (bool disposing)
 

Properties

override string SchemaName [get]
 
- Properties inherited from Deveel.Data.Routines.FunctionProvider
abstract string SchemaName [get]
 
- Properties inherited from Deveel.Data.Sql.Fluid.IConfigurationContext
string SchemaName [get]
 

Private Member Functions

InvokeResult Simple (InvokeContext context, Func< DataObject[], DataObject > func)
 
InvokeResult Binary (InvokeContext context, Func< DataObject, DataObject, DataObject > func)
 
void AddAggregateFunctions ()
 
void AddSecurityFunctions ()
 
void AddConversionFunctions ()
 
void AddSequenceFunctions ()
 
void AddMiscFunctions ()
 

Static Private Member Functions

static SqlType ReturnType (SqlExpression exp, InvokeContext context)
 

Additional Inherited Members

- Public Member Functions inherited from Deveel.Data.Routines.FunctionProvider
IFunction ResolveFunction (Invoke invoke, IQuery query)
 
void Dispose ()
 

Detailed Description

Definition at line 27 of file SystemFunctionsProvider.cs.

Member Function Documentation

void Deveel.Data.Routines.SystemFunctionsProvider.AddAggregateFunctions ( )
inlineprivate

Definition at line 51 of file SystemFunctionsProvider.cs.

51  {
52  Register(configuration => configuration
53  .Named("aggor")
54  .WithParameter(p => p.Named("args").Unbounded().OfDynamicType())
55  .OfAggregateType()
56  .WhenExecute(context => Binary(context, SystemFunctions.Or)));
57 
58  // COUNT
59  Register(config => config.Named("count")
60  .WithUnoundedParameter("args", Function.DynamicType)
61  .WhenExecute(Count.Execute)
62  .OfAggregateType()
63  .ReturnsNumeric());
64 
65  }
A program that takes an optional set of arguments and returns a single value as result of the operati...
InvokeResult Binary(InvokeContext context, Func< DataObject, DataObject, DataObject > func)
void Register(FunctionInfo functionInfo, Func< InvokeContext, InvokeResult > body, Func< InvokeContext, SqlType > returnType)
Defines parameters uniquely identified within the query context by a name. In this form query paramet...
void Deveel.Data.Routines.SystemFunctionsProvider.AddConversionFunctions ( )
inlineprivate

Definition at line 73 of file SystemFunctionsProvider.cs.

73  {
74  Register(config => config.Named("cast")
75  .WithDynamicParameter("value")
76  .WithStringParameter("destType")
77  .WhenExecute(Cast.Execute)
78  .ReturnsType(Cast.ReturnType));
79 
80  Register(config => config.Named("tonumber")
81  .WithDynamicParameter("value")
82  .WhenExecute(context => Simple(context, args => SystemFunctions.ToNumber(args[0])))
83  .ReturnsNumeric());
84 
85  Register(config => config.Named("tostring")
86  .WithDynamicParameter("value")
87  .WhenExecute(context => Simple(context, args => SystemFunctions.ToString(args[0])))
88  .ReturnsString());
89 
90  Register(config => config.Named("tobinary")
91  .WithDynamicParameter("value")
92  .WhenExecute(context => Simple(context, args => SystemFunctions.ToBinary(args[0])))
93  .ReturnsType(PrimitiveTypes.Binary()));
94 
95  // Date Conversions
96  Register(config => config.Named("todate")
97  .WithStringParameter("value")
98  .WhenExecute(context => Simple(context, objects => SystemFunctions.ToDate(objects[0])))
99  .ReturnsType(PrimitiveTypes.Date()));
100 
101  Register(config => config.Named("todatetime")
102  .WithStringParameter("value")
103  .WhenExecute(context => Simple(context, args => SystemFunctions.ToDateTime(args[0])))
104  .ReturnsType(PrimitiveTypes.DateTime()));
105 
106  Register(config => config.Named("totimestamp")
107  .WithParameter(p => p.Named("value").OfStringType())
108  .WhenExecute(context => Simple(context, args => SystemFunctions.ToTimeStamp(args[0])))
109  .ReturnsType(PrimitiveTypes.TimeStamp()));
110  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static BinaryType Binary(int maxSize)
InvokeResult Simple(InvokeContext context, Func< DataObject[], DataObject > func)
void Register(FunctionInfo functionInfo, Func< InvokeContext, InvokeResult > body, Func< InvokeContext, SqlType > returnType)
void Deveel.Data.Routines.SystemFunctionsProvider.AddMiscFunctions ( )
inlineprivate

Definition at line 124 of file SystemFunctionsProvider.cs.

124  {
125  Register(config => config.Named("iif")
126  .WithBooleanParameter("condition")
127  .WithDynamicParameter("ifTrue")
128  .WithDynamicParameter("ifFalse")
129  .WhenExecute(context => SystemFunctions.Iif(context))
130  .ReturnsType(Function.DynamicType));
131 
132  Register(config => config.Named("i_frule_convert")
133  .WithDynamicParameter("rule")
134  .WhenExecute(context => Simple(context, args => SystemFunctions.FRuleConvert(args[0])))
135  .ReturnsType(context => {
136  var argType = ReturnType(context.Arguments[0], context);
138  }));
139  }
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
InvokeResult Simple(InvokeContext context, Func< DataObject[], DataObject > func)
static NumericType Numeric()
A program that takes an optional set of arguments and returns a single value as result of the operati...
Defines the properties of a specific SQL Type and handles the values compatible.
Definition: SqlType.cs:33
void Register(FunctionInfo functionInfo, Func< InvokeContext, InvokeResult > body, Func< InvokeContext, SqlType > returnType)
static SqlType ReturnType(SqlExpression exp, InvokeContext context)
void Deveel.Data.Routines.SystemFunctionsProvider.AddSecurityFunctions ( )
inlineprivate

Definition at line 67 of file SystemFunctionsProvider.cs.

67  {
68  Register(config => config.Named("user")
69  .WhenExecute(context => context.Result(SystemFunctions.User(context.Request)))
70  .ReturnsString());
71  }
void Register(FunctionInfo functionInfo, Func< InvokeContext, InvokeResult > body, Func< InvokeContext, SqlType > returnType)
void Deveel.Data.Routines.SystemFunctionsProvider.AddSequenceFunctions ( )
inlineprivate

Definition at line 112 of file SystemFunctionsProvider.cs.

112  {
113  Register(config => config.Named("uniquekey")
114  .WithStringParameter("table")
115  .WhenExecute(context => Simple(context, args => SystemFunctions.UniqueKey(context.Request, args[0])))
116  .ReturnsNumeric());
117 
118  Register(config => config.Named("curval")
119  .WithStringParameter("table")
120  .WhenExecute(context => Simple(context, args => SystemFunctions.CurrentValue(context.Request, args[0])))
121  .ReturnsNumeric());
122  }
InvokeResult Simple(InvokeContext context, Func< DataObject[], DataObject > func)
void Register(FunctionInfo functionInfo, Func< InvokeContext, InvokeResult > body, Func< InvokeContext, SqlType > returnType)
InvokeResult Deveel.Data.Routines.SystemFunctionsProvider.Binary ( InvokeContext  context,
Func< DataObject, DataObject, DataObject func 
)
inlineprivate

Definition at line 45 of file SystemFunctionsProvider.cs.

45  {
46  var evaluated = context.EvaluatedArguments;
47  var value = func(evaluated[0], evaluated[1]);
48  return context.Result(value);
49  }
override ObjectName Deveel.Data.Routines.SystemFunctionsProvider.NormalizeName ( ObjectName  functionName)
inlineprotectedvirtual

Reimplemented from Deveel.Data.Routines.FunctionProvider.

Definition at line 32 of file SystemFunctionsProvider.cs.

32  {
33  if (functionName.Parent == null)
34  return new ObjectName(new ObjectName(SchemaName), functionName.Name);
35 
36  return base.NormalizeName(functionName);
37  }
Describes the name of an object within a database.
Definition: ObjectName.cs:44
ObjectName Parent
Gets the parent reference of the current one, if any or null if none.
Definition: ObjectName.cs:99
string Name
Gets the name of the object being referenced.
Definition: ObjectName.cs:108
override void Deveel.Data.Routines.SystemFunctionsProvider.OnInit ( )
inlineprotectedvirtual
static SqlType Deveel.Data.Routines.SystemFunctionsProvider.ReturnType ( SqlExpression  exp,
InvokeContext  context 
)
inlinestaticprivate

Definition at line 141 of file SystemFunctionsProvider.cs.

141  {
142  return exp.ReturnType(context.Request, context.VariableResolver);
143  }
InvokeResult Deveel.Data.Routines.SystemFunctionsProvider.Simple ( InvokeContext  context,
Func< DataObject[], DataObject func 
)
inlineprivate

Definition at line 39 of file SystemFunctionsProvider.cs.

39  {
40  var evaluated = context.EvaluatedArguments;
41  var value = func(evaluated);
42  return context.Result(value);
43  }

Property Documentation

override string Deveel.Data.Routines.SystemFunctionsProvider.SchemaName
get

Definition at line 28 of file SystemFunctionsProvider.cs.


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