fx\src\data\System\Data\Filter\FunctionNode.cs (56)
50for (int i = 0; i < funcs.Length; i++) {
51if (String.Compare(funcs[i].name, name, StringComparison.OrdinalIgnoreCase) == 0) {
63if (!funcs[info].IsVariantArgumentList && argumentCount >= funcs[info].argumentCount)
83if (funcs[info].id == FunctionId.Convert) {
106Debug.Assert(info < funcs.Length && info >= 0, "Invalid function info.");
110Debug.Assert(this.argumentCount == funcs[info].argumentCount || funcs[info].IsVariantArgumentList, "Invalid argument argumentCount.");
113if (funcs[info].id == FunctionId.Convert) {
120else if (funcs[info].id != FunctionId.Iif) { // We do not want to evaluate arguments of IIF, we =will alread do it in EvalFunction/ second point: we may go to div by 0
124if (funcs[info].IsValidateArguments) {
125if ((argumentValues[i] == DBNull.Value) || (typeof(object) == funcs[info].parameters[i])) {
131if (argumentValues[i].GetType() != funcs[info].parameters[i]) {
134if (funcs[info].parameters[i] == typeof(int) && ExpressionNode.IsInteger(DataStorage.GetStorageType(argumentValues[i].GetType()))) {
137else if ((funcs[info].id == FunctionId.Trim) || (funcs[info].id == FunctionId.Substring)|| (funcs[info].id == FunctionId.Len)) {
139throw ExprException.ArgumentType(funcs[info].name, i+1, funcs[info].parameters[i]);
143throw ExprException.ArgumentType(funcs[info].name, i+1, funcs[info].parameters[i]);
149return EvalFunction(funcs[info].id, argumentValues, row, version);
214if (funcs[this.info].id == FunctionId.In) {
242throw ExprException.ArgumentType(funcs[info].name, 2, typeof(Type));
258Debug.Assert(argumentCount == 1, "Invalid argument argumentCount for " + funcs[info].name + " : " + argumentCount.ToString(FormatProvider));
266throw ExprException.ArgumentTypeInteger(funcs[info].name, 1);
269Debug.Assert(argumentCount == 1, "Invalid argument argumentCount for " + funcs[info].name + " : " + argumentCount.ToString(FormatProvider));
286Debug.Assert(argumentCount == 1, "Invalid argument argumentCount for " + funcs[info].name + " : " + argumentCount.ToString(FormatProvider));
290Debug.Assert(argumentCount == 1, "Invalid argument argumentCount for " + funcs[info].name + " : " + argumentCount.ToString(FormatProvider));
294Debug.Assert(argumentCount == 1, "Invalid argument argumentCount for " + funcs[info].name + " : " + argumentCount.ToString(FormatProvider));
298Debug.Assert(argumentCount == 1, "Invalid argument argumentCount for " + funcs[info].name + " : " + argumentCount.ToString(FormatProvider));
302Debug.Assert(argumentCount == 2, "Invalid argument argumentCount for " + funcs[info].name + " : " + argumentCount.ToString(FormatProvider));
304Debug.Assert(argumentValues[0] is string, "Invalid argument type for " + funcs[info].name);
305Debug.Assert(argumentValues[1] is string, "Invalid argument type for " + funcs[info].name);
333throw ExprException.NYI(funcs[info].name);
344Debug.Assert(argumentCount == 1, "Invalid argument argumentCount for " + funcs[info].name + " : " + argumentCount.ToString(FormatProvider));
345Debug.Assert((argumentValues[0] is string)||(argumentValues[0] is SqlString), "Invalid argument type for " + funcs[info].name);
361Debug.Assert((argumentValues[0] is string)||(argumentValues[0] is SqlString), "Invalid first argument " + argumentValues[0].GetType().FullName + " in " + funcs[info].name);
362Debug.Assert(argumentValues[1] is int, "Invalid second argument " + argumentValues[1].GetType().FullName + " in " + funcs[info].name);
363Debug.Assert(argumentValues[2] is int, "Invalid third argument " + argumentValues[2].GetType().FullName + " in " + funcs[info].name);
400Debug.Assert(argumentCount == 1, "Invalid argument argumentCount for " + funcs[info].name + " : " + argumentCount.ToString(FormatProvider));
401Debug.Assert((argumentValues[0] is string)||(argumentValues[0] is SqlString), "Invalid argument type for " + funcs[info].name);
483throw ExprException.UndefinedFunction(funcs[info].name);
490return funcs[this.info].id;
498bool aggregate = (funcs[this.info].id == FunctionId.Sum) ||
499(funcs[this.info].id == FunctionId.Avg) ||
500(funcs[this.info].id == FunctionId.Min) ||
501(funcs[this.info].id == FunctionId.Max) ||
502(funcs[this.info].id == FunctionId.Count) ||
503(funcs[this.info].id == FunctionId.StDev) ||
504(funcs[this.info].id == FunctionId.Var);
510Function f = funcs[info];
514if (funcs[info].IsVariantArgumentList) {
516if (argumentCount < funcs[info].argumentCount) {
518if (funcs[this.info].id == FunctionId.In)
526if (argumentCount != funcs[info].argumentCount)