コード例 #1
0
        internal override bool MatchesInvoke(Invoke request, IQuery query)
        {
            if (request == null)
            {
                return(false);
            }

            bool ignoreCase = true;

            if (query != null)
            {
                ignoreCase = query.IgnoreIdentifiersCase();
            }

            if (!RoutineName.Equals(request.RoutineName, ignoreCase))
            {
                return(false);
            }

            // TODO: add a better resolution to obtain the final type of the argument
            //       and compare it to the parameter type definition
            bool unboundedSeen = false;

            for (int i = 0; i < request.Arguments.Length; i++)
            {
                var argType = request.Arguments[i].ReturnType(query, null);

                if (i + 1 > Parameters.Length)
                {
                    if (!unboundedSeen)
                    {
                        return(false);
                    }

                    // TODO: verify the type of the argument (how to evaluate?)
                }
                else
                {
                    var param = Parameters[i];
                    unboundedSeen = param.IsUnbounded;

                    var paramType = param.Type;

                    if (!paramType.IsComparable(argType))
                    {
                        return(false);
                    }
                }
            }

            if (!unboundedSeen &&
                request.Arguments.Length != Parameters.Length)
            {
                return(false);
            }

            return(true);
        }
コード例 #2
0
        internal override bool MatchesInvoke(Invoke invoke, IRequest request)
        {
            if (invoke == null)
            {
                return(false);
            }

            if (!RoutineName.Equals(invoke.RoutineName))
            {
                return(false);
            }

            // TODO: add a better resolution to obtain the final type of the argument
            //       and compare it to the parameter type definition
            bool unboundedSeen = false;

            for (int i = 0; i < invoke.Arguments.Length; i++)
            {
                var argType = invoke.Arguments[i].Value.ReturnType(request, null);

                if (i + 1 > Parameters.Length)
                {
                    if (!unboundedSeen)
                    {
                        return(false);
                    }

                    // TODO: verify the type of the argument (how to evaluate?)
                }
                else
                {
                    var param = Parameters[i];
                    unboundedSeen = param.IsUnbounded;

                    var paramType = param.Type;

                    if (!paramType.IsComparable(argType))
                    {
                        return(false);
                    }
                }
            }

            if (!unboundedSeen &&
                invoke.Arguments.Length != Parameters.Length)
            {
                return(false);
            }

            return(true);
        }
コード例 #3
0
        internal override bool MatchesInvoke(Invoke invoke, IQuery query)
        {
            if (invoke == null)
            {
                return(false);
            }

            bool ignoreCase = true;

            if (query != null)
            {
                ignoreCase = query.IgnoreIdentifiersCase();
            }

            if (!RoutineName.Equals(invoke.RoutineName, ignoreCase))
            {
                return(false);
            }


            var inputParams = Parameters.Where(parameter => parameter.IsInput).ToList();

            if (invoke.Arguments.Length != inputParams.Count)
            {
                return(false);
            }

            for (int i = 0; i < invoke.Arguments.Length; i++)
            {
                // TODO: support variable evaluation here? or evaluate parameters before reaching here?
                if (!invoke.Arguments[i].IsConstant())
                {
                    return(false);
                }

                var argType   = invoke.Arguments[i].ReturnType(query, null);
                var paramType = Parameters[i].Type;

                // TODO: verify if this is assignable (castable) ...
                if (!paramType.IsComparable(argType))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #4
0
        internal override bool MatchesInvoke(Invoke invoke, IRequest request)
        {
            if (invoke == null)
            {
                return(false);
            }

            if (!RoutineName.Equals(invoke.RoutineName))
            {
                return(false);
            }


            var inputParams = Parameters.Where(parameter => parameter.IsInput).ToList();

            if (invoke.Arguments.Length != inputParams.Count)
            {
                return(false);
            }

            for (int i = 0; i < invoke.Arguments.Length; i++)
            {
                if (!invoke.Arguments[i].Value.IsConstant())
                {
                    return(false);
                }

                var argType   = invoke.Arguments[i].Value.ReturnType(request, null);
                var paramType = Parameters[i].Type;

                // TODO: verify if this is assignable (castable) ...
                if (!paramType.IsComparable(argType))
                {
                    return(false);
                }
            }

            return(true);
        }