System\Data\Filter\FunctionNode.cs (55)
52for (int i = 0; i < s_funcs.Length; i++)
54if (string.Equals(s_funcs[i]._name, name, StringComparison.OrdinalIgnoreCase))
69if (!s_funcs[_info]._isVariantArgumentList && _argumentCount >= s_funcs[_info]._argumentCount)
92if (s_funcs[_info]._id == FunctionId.Convert)
123Debug.Assert(_info < s_funcs.Length && _info >= 0, "Invalid function info.");
127Debug.Assert(_argumentCount == s_funcs[_info]._argumentCount || s_funcs[_info]._isVariantArgumentList, "Invalid argument argumentCount.");
130if (s_funcs[_info]._id == FunctionId.Convert)
138else if (s_funcs[_info]._id != FunctionId.Iif)
144if (s_funcs[_info]._isValidateArguments)
146if ((argumentValues[i] == DBNull.Value) || (typeof(object) == s_funcs[_info]._parameters[i]))
153if (argumentValues[i].GetType() != s_funcs[_info]._parameters[i])
157if (s_funcs[_info]._parameters[i] == typeof(int) && ExpressionNode.IsInteger(DataStorage.GetStorageType(argumentValues[i].GetType())))
161else if ((s_funcs[_info]._id == FunctionId.Trim) || (s_funcs[_info]._id == FunctionId.Substring) || (s_funcs[_info]._id == FunctionId.Len))
165throw ExprException.ArgumentType(s_funcs[_info]._name, i + 1, s_funcs[_info]._parameters[i]!);
170throw ExprException.ArgumentType(s_funcs[_info]._name, i + 1, s_funcs[_info]._parameters[i]!);
176return EvalFunction(s_funcs[_info]._id, argumentValues, row, version);
260if (s_funcs[_info]._id == FunctionId.In)
296throw ExprException.ArgumentType(s_funcs[_info]._name, 2, typeof(Type));
321Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}");
329throw ExprException.ArgumentTypeInteger(s_funcs[_info]._name, 1);
332Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}");
344Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}");
348Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}");
352Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}");
356Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}");
360Debug.Assert(_argumentCount == 2, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}");
362Debug.Assert(argumentValues[0] is string, $"Invalid argument type for {s_funcs[_info]._name}");
363Debug.Assert(argumentValues[1] is string, $"Invalid argument type for {s_funcs[_info]._name}");
393throw ExprException.NYI(s_funcs[_info]._name);
404Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}");
405Debug.Assert((argumentValues[0] is string) || (argumentValues[0] is SqlString), $"Invalid argument type for {s_funcs[_info]._name}");
424Debug.Assert((argumentValues[0] is string) || (argumentValues[0] is SqlString), $"Invalid first argument {argumentValues[0].GetType().FullName} in {s_funcs[_info]._name}");
425Debug.Assert(argumentValues[1] is int, $"Invalid second argument {argumentValues[1].GetType().FullName} in {s_funcs[_info]._name}");
426Debug.Assert(argumentValues[2] is int, $"Invalid third argument {argumentValues[2].GetType().FullName} in {s_funcs[_info]._name}");
465Debug.Assert(_argumentCount == 1, $"Invalid argument argumentCount for {s_funcs[_info]._name} : {_argumentCount.ToString(FormatProvider)}");
466Debug.Assert((argumentValues[0] is string) || (argumentValues[0] is SqlString), $"Invalid argument type for {s_funcs[_info]._name}");
564throw ExprException.UndefinedFunction(s_funcs[_info]._name);
574return s_funcs[_info]._id;
584bool aggregate = (s_funcs[_info]._id == FunctionId.Sum) ||
585(s_funcs[_info]._id == FunctionId.Avg) ||
586(s_funcs[_info]._id == FunctionId.Min) ||
587(s_funcs[_info]._id == FunctionId.Max) ||
588(s_funcs[_info]._id == FunctionId.Count) ||
589(s_funcs[_info]._id == FunctionId.StDev) ||
590(s_funcs[_info]._id == FunctionId.Var);
600if (s_funcs[_info]._isVariantArgumentList)
603if (_argumentCount < s_funcs[_info]._argumentCount)
606if (s_funcs[_info]._id == FunctionId.In)
614if (_argumentCount != s_funcs[_info]._argumentCount)