Inheritance: CacheOutputQuery
Exemplo n.º 1
0
 private IDQuery(IDQuery other) : base(other)
 {
 }
Exemplo n.º 2
0
        private Query ProcessFunction(Function root, out Props props)
        {
            props = Props.None;
            Query qy = null;

            switch (root.TypeOfFunction)
            {
            case FT.FuncLast:
                qy     = new NodeFunctions(root.TypeOfFunction, null);
                props |= Props.HasLast;
                return(qy);

            case FT.FuncPosition:
                qy     = new NodeFunctions(root.TypeOfFunction, null);
                props |= Props.HasPosition;
                return(qy);

            case FT.FuncCount:
                return(new NodeFunctions(FT.FuncCount,
                                         ProcessNode((AstNode)(root.ArgumentList[0]), Flags.None, out props)
                                         ));

            case FT.FuncID:
                qy     = new IDQuery(ProcessNode((AstNode)(root.ArgumentList[0]), Flags.None, out props));
                props |= Props.NonFlat;
                return(qy);

            case FT.FuncLocalName:
            case FT.FuncNameSpaceUri:
            case FT.FuncName:
                if (root.ArgumentList != null && root.ArgumentList.Count > 0)
                {
                    return(new NodeFunctions(root.TypeOfFunction,
                                             ProcessNode((AstNode)(root.ArgumentList[0]), Flags.None, out props)
                                             ));
                }
                else
                {
                    return(new NodeFunctions(root.TypeOfFunction, null));
                }

            case FT.FuncString:
            case FT.FuncConcat:
            case FT.FuncStartsWith:
            case FT.FuncContains:
            case FT.FuncSubstringBefore:
            case FT.FuncSubstringAfter:
            case FT.FuncSubstring:
            case FT.FuncStringLength:
            case FT.FuncNormalize:
            case FT.FuncTranslate:
                return(new StringFunctions(root.TypeOfFunction, ProcessArguments(root.ArgumentList, out props)));

            case FT.FuncNumber:
            case FT.FuncSum:
            case FT.FuncFloor:
            case FT.FuncCeiling:
            case FT.FuncRound:
                if (root.ArgumentList != null && root.ArgumentList.Count > 0)
                {
                    return(new NumberFunctions(root.TypeOfFunction,
                                               ProcessNode((AstNode)root.ArgumentList[0], Flags.None, out props)
                                               ));
                }
                else
                {
                    return(new NumberFunctions(Function.FunctionType.FuncNumber, null));
                }

            case FT.FuncTrue:
            case FT.FuncFalse:
                return(new BooleanFunctions(root.TypeOfFunction, null));

            case FT.FuncNot:
            case FT.FuncLang:
            case FT.FuncBoolean:
                return(new BooleanFunctions(root.TypeOfFunction,
                                            ProcessNode((AstNode)root.ArgumentList[0], Flags.None, out props)
                                            ));

            case FT.FuncUserDefined:
                needContext = true;
                if (!allowCurrent && root.Name == "current" && root.Prefix.Length == 0)
                {
                    throw XPathException.Create(Res.Xp_CurrentNotAllowed);
                }
                if (!allowKey && root.Name == "key" && root.Prefix.Length == 0)
                {
                    throw XPathException.Create(Res.Xp_InvalidKeyPattern, query);
                }
                qy     = new FunctionQuery(root.Prefix, root.Name, ProcessArguments(root.ArgumentList, out props));
                props |= Props.NonFlat;
                return(qy);

            default:
                throw XPathException.Create(Res.Xp_NotSupported, query);
            }
        }
Exemplo n.º 3
0
 private IDQuery(IDQuery other) : base((CacheOutputQuery)other)
 {
 }