18 using System.Collections.Generic;
26 namespace Deveel.Data.Routines {
28 public override string SchemaName {
33 if (functionName.
Parent == null)
36 return base.NormalizeName(functionName);
41 var value = func(evaluated);
42 return context.
Result(value);
47 var value = func(evaluated[0], evaluated[1]);
48 return context.
Result(value);
52 Register(configuration => configuration
54 .WithParameter(p => p.Named(
"args").Unbounded().OfDynamicType())
59 Register(config => config.Named(
"count")
68 Register(config => config.Named(
"user")
74 Register(config => config.Named(
"cast")
75 .WithDynamicParameter(
"value")
76 .WithStringParameter(
"destType")
80 Register(config => config.Named(
"tonumber")
81 .WithDynamicParameter(
"value")
85 Register(config => config.Named(
"tostring")
86 .WithDynamicParameter(
"value")
90 Register(config => config.Named(
"tobinary")
91 .WithDynamicParameter(
"value")
96 Register(config => config.Named(
"todate")
97 .WithStringParameter(
"value")
101 Register(config => config.Named(
"todatetime")
102 .WithStringParameter(
"value")
106 Register(config => config.Named(
"totimestamp")
107 .WithParameter(p => p.Named(
"value").OfStringType())
113 Register(config => config.Named(
"uniquekey")
114 .WithStringParameter(
"table")
118 Register(config => config.Named(
"curval")
119 .WithStringParameter(
"table")
125 Register(config => config.Named(
"iif")
126 .WithBooleanParameter(
"condition")
127 .WithDynamicParameter(
"ifTrue")
128 .WithDynamicParameter(
"ifFalse")
132 Register(config => config.Named(
"i_frule_convert")
133 .WithDynamicParameter(
"rule")
135 .ReturnsType(context => {
136 var argType = ReturnType(context.Arguments[0], context);
146 AddAggregateFunctions();
148 AddConversionFunctions();
149 AddSecurityFunctions();
150 AddSequenceFunctions();
160 throw new Exception(
"'count' can only be used as an aggregate function.");
171 int totalCount = size;
174 for (
int i = 0; i < size; ++i) {
184 return context.
Result(result);
190 #region DistinctCount
194 throw new NotImplementedException();
Provides some helper functions for resolving and creating SqlType instances that are primitive to the...
static DataObject Integer(int value)
static readonly SqlType DynamicType
A special SqlType that is used to mark an argument of a function as dynamic.
static DataObject ToDate(DataObject obj)
static InvokeResult Execute(InvokeContext context)
A system routine that returns a value at the end of its execution.
static InvokeResult Iif(InvokeContext context)
IVariableResolver GetVariableResolver(int setIndex)
Returns a IVariableResolver that can be used to resolve variable in the get set of the group...
static DataObject CurrentValue(IRequest query, DataObject tableName)
SqlExpression[] Arguments
Gets the array of expressions forming the arguments of the execution.
static BinaryType Binary(int maxSize)
Invoke Invoke
Gets the information about the invoke of the routine.
static DataObject UniqueKey(IRequest query, DataObject tableName)
static DataObject Or(DataObject ob1, DataObject ob2)
Describes the name of an object within a database.
static InvokeResult Execute(InvokeContext context)
static InvokeResult Execute(InvokeContext context)
ISqlObject Value
Gets the underlined value that is handled.
static DataObject ToBinary(DataObject value)
IVariableResolver VariableResolver
bool IsGlobArgument
Gets a boolean value indicating if the arguments of the invocation represent a single glob (*)...
InvokeResult Simple(InvokeContext context, Func< DataObject[], DataObject > func)
override ObjectName NormalizeName(ObjectName functionName)
static DataObject ToString(DataObject value)
static DateType TimeStamp()
IGroupResolver GroupResolver
static DataObject ToNumber(DataObject value)
static DataObject Cast(DataObject value, SqlType destType)
static NumericType Numeric()
DataObject[] EvaluatedArguments
void AddSequenceFunctions()
Represents the result of the execution of a routine.
Represents a dynamic object that encapsulates a defined SqlType and a compatible constant ISqlObject ...
static DateType DateTime()
static DataObject ToTimeStamp(DataObject obj)
static DataObject User(IRequest query)
InvokeResult Binary(InvokeContext context, Func< DataObject, DataObject, DataObject > func)
Provides utilities and properties for handling the SYSTEN schema of a database.
Defines the properties of a specific SQL Type and handles the values compatible.
ObjectName Parent
Gets the parent reference of the current one, if any or null if none.
static SqlType ReturnType(SqlExpression exp, InvokeContext context)
InvokeResult Result(DataObject value)
string Name
Gets the name of the object being referenced.
Defines parameters uniquely identified within the query context by a name. In this form query paramet...
static StringType String()
void AddConversionFunctions()
static SqlType ReturnType(InvokeContext context)
int Count
Gets the total number of items in this group.
Defines the base class for instances that represent SQL expression tree nodes.
const string Name
The name of the system schema that contains tables referring to system information.
static DataObject FRuleConvert(DataObject obj)
static DataObject ToDateTime(DataObject obj)
void AddAggregateFunctions()
void AddSecurityFunctions()
static SqlType Parse(string s)
Parses a SQL formatted string that defines a data-type into a constructed SqlType object equivalent...