Exemple #1
0
 internal void HandleSingleQuotes()
 {
     this.m_ExpressionUsedSingleQuotes = false;
     if (this.m_Exp.GetType() == typeof(MDXStringConstNode))
     {
         MDXStringConstNode exp = (MDXStringConstNode)this.m_Exp;
         if (exp.SingleQuote)
         {
             string mdx = exp.GetString().Replace("''", "'");
             Source src = exp.Source.Clone();
             src.StartLocation = exp.Locator;
             Locator startLocation = src.StartLocation;
             startLocation.Position++;
             Locator locator2 = src.StartLocation;
             locator2.Column++;
             MDXParser parser = new MDXParser(mdx, src, null);
             parser.ParseExpression();
             this.m_Exp = parser.GetNode().GetExpNode();
             if (this.m_Exp == null)
             {
                 throw new Exception(string.Format("Error parsing MDX: {0}: MDX expression expected", exp.GetString()));
             }
             this.m_Exp.Locator.Adjust(src.StartLocation);
             this.m_ExpressionUsedSingleQuotes = true;
         }
     }
 }
Exemple #2
0
 internal static bool IsCachePrimitive(MDXExpNode e)
 {
     if (((e.GetType() != typeof(MDXIntegerConstNode)) && (e.GetType() != typeof(MDXFloatConstNode))) && ((e.GetType() != typeof(MDXStringConstNode)) && (e.GetType() != typeof(MDXIDNode))))
     {
         return(e.GetType() == typeof(MDXParamNode));
     }
     return(true);
 }
 internal MDXUnaryOpNode(string LexString, MDXExpNode exp)
 {
     this.m_Op  = LexString.ToUpper();
     this.m_Exp = exp;
     if (this.m_Exp.GetType() == typeof(MDXBinOpNode))
     {
         (this.m_Exp as MDXBinOpNode).SetUpstreamOp(this.m_Op);
     }
 }
Exemple #4
0
 internal MDXAxisNode(string name, MDXExpNode exp, MDXExpListNode dimprops, MDXExpNode having)
 {
     this.m_Name     = name;
     this.m_Exp      = exp;
     this.m_Having   = having;
     this.m_DimProps = dimprops;
     if (this.m_Having != null)
     {
         this.m_Having.SetOuterIterator(this.m_Exp);
     }
 }
Exemple #5
0
 internal override bool IsCacheTrivial()
 {
     foreach (MDXExpNode node in this.m_List)
     {
         if (MDXExpNode.IsCachePrimitive(node))
         {
             return(false);
         }
     }
     return(true);
 }
Exemple #6
0
 internal MDXWithNode(MDXExpNode name, MDXExpNode exp, MDXListNode <MDXCalcPropNode> calcprops, bool newsyntax)
 {
     if (name.GetType() != typeof(MDXIDNode))
     {
         throw new Exception("Syntax error: Cannot use '" + name.GetMDX(-1) + "' in the WITH clause");
     }
     this.m_Name      = name as MDXIDNode;
     this.m_Exp       = exp;
     this.m_CalcProps = calcprops;
     this.m_NewSyntax = newsyntax;
 }
Exemple #7
0
 private static bool IsFunction(MDXExpNode e, string fname)
 {
     if (e.GetType() == typeof(MDXFunctionNode))
     {
         MDXFunctionNode node = e as MDXFunctionNode;
         if (node.m_Function.Equals(fname, StringComparison.InvariantCultureIgnoreCase))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #8
0
 private static bool IsNameFunction(MDXExpNode e)
 {
     if (e.GetType() == typeof(MDXPropertyNode))
     {
         MDXPropertyNode node = e as MDXPropertyNode;
         if ((node.m_Function.Equals("Name", StringComparison.InvariantCultureIgnoreCase) || node.m_Function.Equals("UniqueName", StringComparison.InvariantCultureIgnoreCase)) || node.m_Function.Equals("Member_Caption", StringComparison.InvariantCultureIgnoreCase))
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #9
0
 private static bool IsConstant(MDXExpNode e, int c)
 {
     if (e.GetType() == typeof(MDXIntegerConstNode))
     {
         MDXIntegerConstNode node = e as MDXIntegerConstNode;
         if (node.m_Int == c)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #10
0
 internal MDXBinOpNode(string LexString, MDXExpNode exp1, MDXExpNode exp2)
 {
     this.m_Op   = LexString.ToUpper();
     this.m_Exp1 = exp1;
     this.m_Exp2 = exp2;
     if (this.m_Exp1.GetType() == typeof(MDXBinOpNode))
     {
         (this.m_Exp1 as MDXBinOpNode).SetUpstreamOp(this.m_Op);
     }
     if (this.m_Exp2.GetType() == typeof(MDXBinOpNode))
     {
         (this.m_Exp2 as MDXBinOpNode).SetUpstreamOp(this.m_Op);
     }
 }
Exemple #11
0
 internal void ApplyNonEmpty(MDXAxesListNode axes)
 {
     if (this.m_Exp.GetType() == typeof(MDXNonEmptyNode))
     {
         MDXNonEmptyNode exp = this.m_Exp as MDXNonEmptyNode;
         foreach (MDXAxisNode node2 in axes)
         {
             if (node2 != this)
             {
                 MDXExpNode set = node2.GetSet();
                 if (set.GetType() == typeof(MDXNonEmptyNode))
                 {
                     set = (set as MDXNonEmptyNode).GetSet();
                 }
                 exp.AddFilter(set);
             }
         }
     }
 }
Exemple #12
0
 internal override bool IsCacheTrivial()
 {
     return(MDXExpNode.IsCachePrimitive(this.m_Exp1) && MDXExpNode.IsCachePrimitive(this.m_Exp2));
 }
Exemple #13
0
 internal MDXAssignmentNode(string prop, MDXExpNode lvalue, MDXExpNode rvalue)
 {
     this.m_Prop   = prop;
     this.m_LValue = lvalue;
     this.m_RValue = rvalue;
 }
Exemple #14
0
 internal MDXWithCalcCellNode(MDXExpNode name, string scope, MDXExpNode exp, MDXListNode <MDXCalcPropNode> calcprops) : base(name, exp, calcprops, false)
 {
     this.m_Scope = scope;
 }
Exemple #15
0
 internal MDXWithSetNode(MDXExpNode name, MDXExpNode exp, MDXListNode <MDXCalcPropNode> calcprops, bool newsyntax) : base(name, exp, calcprops, newsyntax)
 {
 }
Exemple #16
0
        public override SSYaccStackElement reduce(int q_prod, int q_size)
        {
            string    canonicalName;
            MDXObject obj2;
            bool      flag;

            if (this.m_Cancel)
            {
                base.doError();
                return(null);
            }
            if (this.m_ColorCodeOnly)
            {
                return(this.ColorCodeReduce(q_prod, q_size));
            }
            MDXStackElem elem = (MDXStackElem)this.stackElement();

            switch (q_prod)
            {
            case 1:
                this.m_Node = this.ChildNode(1);
                return(elem);

            case 2:
                this.m_Node = this.ChildNode(0);
                return(elem);

            case 3:
            {
                MDXScriptNode    node64 = new MDXScriptNode();
                MDXStatementNode stmt   = (MDXStatementNode)this.ChildNode(0);
                node64.Add(stmt);
                elem.SetNode(node64);
                return(elem);
            }

            case 4:
            case 6:
            {
                MDXScriptNode    node66 = (MDXScriptNode)this.ChildNode(0);
                MDXStatementNode node67 = (MDXStatementNode)this.ChildNode(2);
                if (q_prod == 6)
                {
                    node66.Add(new MDXGoNode());
                }
                node66.Add(node67);
                elem.SetNode(node66);
                return(elem);
            }

            case 5:
                elem.SetNode(this.ChildNode(0));
                return(elem);

            case 7:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 8:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 9:
                elem.SetNode(null);
                return(elem);

            case 10:
            {
                this.ColorKeyword(0);
                MDXSelectNode       select      = this.ChildNode(3) as MDXSelectNode;
                MDXExpListNode      returnattrs = this.ChildNode(4) as MDXExpListNode;
                MDXDrillThroughNode node81      = new MDXDrillThroughNode(select, returnattrs);
                this.SetSource(node81, 5);
                elem.SetNode(node81);
                return(elem);
            }

            case 11:
                elem.SetNode(this.ChildNode(0));
                return(elem);

            case 12:
            {
                this.ColorKeyword(0);
                MDXCalculateNode node76 = new MDXCalculateNode();
                this.SetSource(node76, 1);
                elem.SetNode(node76);
                return(elem);
            }

            case 13:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 14:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 15:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 0x10:
            {
                MDXFreezeNode node95 = new MDXFreezeNode();
                elem.SetNode(node95);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x11:
                this.ColorKeyword(0);
                this.ColorKeyword(2);
                this.ColorKeyword(4);
                this.ColorKeyword(5);
                elem.SetNode(null);
                return(elem);

            case 0x12:
            {
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                MDXWithListNode withs = (MDXWithListNode)this.ChildNode(0);
                MDXAxesListNode axes  = (MDXAxesListNode)this.ChildNode(2);
                MDXWhereNode where = (MDXWhereNode)this.ChildNode(5);
                MDXSelectNode      subselect = null;
                MDXStringConstNode cube      = null;
                if (this.ChildNode(4).GetType() != typeof(MDXSelectNode))
                {
                    cube = this.ChildNode(4) as MDXStringConstNode;
                }
                else
                {
                    subselect = this.ChildNode(4) as MDXSelectNode;
                }
                MDXExpListNode cellprops = this.ChildNode(6) as MDXExpListNode;
                MDXSelectNode  node42    = new MDXSelectNode(withs, axes, where, subselect, cube, cellprops);
                this.SetSource(node42, 7);
                elem.SetNode(node42);
                return(elem);
            }

            case 0x13:
            {
                this.ColorKeyword(0);
                MDXWithListNode node77 = this.ChildNode(2) as MDXWithListNode;
                MDXCreateNode   node78 = new MDXCreateNode(node77, this.ChildNode(1) != null);
                this.SetSource(node78, 3);
                elem.SetNode(node78);
                return(elem);
            }

            case 20:
            {
                this.ColorKeyword(0);
                MDXIDNode         name    = this.ChildNode(2) as MDXIDNode;
                MDXIDNode         exp     = new MDXIDNode("NULL");
                MDXWithMemberNode t       = new MDXWithMemberNode(name, exp, null, true);
                MDXWithListNode   node107 = new MDXWithListNode();
                node107.Add(t);
                MDXCreateNode node108 = new MDXCreateNode(node107, this.ChildNode(1) != null);
                elem.SetNode(node108);
                this.SetSource(elem.GetNode(), 3);
                return(elem);
            }

            case 0x15:
            {
                this.ColorKeyword(0);
                MDXWithMemberNode node101 = new MDXWithMemberNode(this.ChildExpNode(2), this.ChildExpNode(4), null, true);
                MDXWithListNode   node102 = new MDXWithListNode();
                node102.Add(node101);
                MDXCreateNode node103 = new MDXCreateNode(node102, this.ChildNode(1) != null);
                elem.SetNode(node103);
                this.SetSource(elem.GetNode(), 5);
                return(elem);
            }

            case 0x16:
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                this.ColorKeyword(4);
                return(elem);

            case 0x17:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(4);
                this.ColorKeyword(5);
                MDXScriptNode   script = this.ChildNode(3) as MDXScriptNode;
                MDXEndScopeNode node97 = new MDXEndScopeNode();
                this.SetSource(node97, 4, 5);
                MDXScopeNode node98 = new MDXScopeNode(this.ChildExpNode(1), script, node97);
                elem.SetNode(node98);
                this.SetSource(elem.GetNode(), 6);
                return(elem);
            }

            case 0x18:
            {
                MDXAssignmentNode node99 = new MDXAssignmentNode(null, this.ChildExpNode(0), this.ChildExpNode(2));
                elem.SetNode(node99);
                this.SetSource(elem.GetNode(), 3);
                return(elem);
            }

            case 0x19:
            {
                MDXAssignmentNode node100 = new MDXAssignmentNode(this.LexChildString(0), this.ChildExpNode(2), this.ChildExpNode(5));
                elem.SetNode(node100);
                this.SetSource(elem.GetNode(), 6);
                return(elem);
            }

            case 0x1a:
                this.ColorKeyword(0);
                return(elem);

            case 0x1b:
                this.ColorKeyword(0);
                return(elem);

            case 0x1c:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                string               str10  = this.LexChildString(2);
                MDXSelectNode        node82 = this.ChildNode(4) as MDXSelectNode;
                MDXCreateSubcubeNode node83 = new MDXCreateSubcubeNode(str10, node82);
                this.SetSource(node83, 5);
                elem.SetNode(node83);
                return(elem);
            }

            case 0x1d:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                string               str11  = this.LexChildString(2);
                MDXSelectNode        node84 = this.ChildNode(5) as MDXSelectNode;
                MDXCreateSubcubeNode node85 = new MDXCreateSubcubeNode(str11, node84);
                this.SetSource(node85, 7);
                elem.SetNode(node85);
                return(elem);
            }

            case 30:
            {
                MDXWithListNode node43 = new MDXWithListNode();
                this.SetSource(node43, 0);
                elem.SetNode(node43);
                return(elem);
            }

            case 0x1f:
            {
                this.ColorKeyword(0);
                MDXWithListNode node44 = (MDXWithListNode)this.ChildNode(1);
                this.SetSource(node44, 2);
                elem.SetNode(node44);
                return(elem);
            }

            case 0x20:
            {
                MDXWithListNode node45 = new MDXWithListNode();
                elem.SetNode(node45);
                return(elem);
            }

            case 0x21:
            {
                MDXWithListNode node46 = (MDXWithListNode)this.ChildNode(0);
                MDXWithNode     node47 = (MDXWithNode)this.ChildNode(1);
                node46.Add(node47);
                this.SetSource(node46, 0, 1);
                elem.SetNode(node46);
                return(elem);
            }

            case 0x22:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(2);
                MDXListNode <MDXCalcPropNode> calcprops = this.ChildNode(4) as MDXListNode <MDXCalcPropNode>;
                MDXWithMemberNode             node49    = new MDXWithMemberNode(this.ChildExpNode(1), this.ChildExpNode(3), calcprops, false);
                this.SetSource(node49, 5);
                node49.HandleSingleQuotes();
                elem.SetNode(node49);
                return(elem);
            }

            case 0x23:
            case 0x24:
            {
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                MDXWithSetNode node50 = new MDXWithSetNode(this.ChildExpNode(2), this.ChildExpNode(4), null, 0x24 == q_prod);
                this.SetSource(node50, 5);
                node50.HandleSingleQuotes();
                elem.SetNode(node50);
                return(elem);
            }

            case 0x25:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                this.ColorKeyword(3);
                this.ColorKeyword(5);
                string scope = this.LexChildString(4);
                MDXWithCalcCellNode node51 = new MDXWithCalcCellNode(this.ChildExpNode(2), scope, this.ChildExpNode(6), null);
                this.SetSource(node51, 8);
                elem.SetNode(node51);
                return(elem);
            }

            case 0x26:
            case 0x30:
            case 0x33:
            case 0x3a:
            case 60:
            case 0x40:
            case 0x42:
            case 0x44:
            case 70:
                return(elem);

            case 0x27:
                this.ColorKeyword(0);
                return(elem);

            case 40:
                this.ColorKeyword(0);
                return(elem);

            case 0x29:
            {
                MDXListNode <MDXCalcPropNode> node68 = new MDXListNode <MDXCalcPropNode>();
                elem.SetNode(node68);
                return(elem);
            }

            case 0x2a:
            {
                MDXExpNode      node69 = this.ChildExpNode(4);
                MDXCalcPropNode node70 = new MDXCalcPropNode(this.LexChildString(2), node69);
                this.SetSource(node70, 2, 4);
                MDXListNode <MDXCalcPropNode> node71 = this.ChildNode(0) as MDXListNode <MDXCalcPropNode>;
                node71.Add(node70);
                this.SetSource(node71, 5);
                elem.SetNode(node71);
                return(elem);
            }

            case 0x2b:
            {
                MDXAxesListNode node52 = new MDXAxesListNode();
                elem.SetNode(node52);
                return(elem);
            }

            case 0x2c:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 0x2d:
            {
                MDXAxesListNode node53 = new MDXAxesListNode();
                MDXAxisNode     node54 = (MDXAxisNode)this.ChildNode(0);
                node53.Add(node54);
                this.SetSource(node53, 1);
                elem.SetNode(node53);
                return(elem);
            }

            case 0x2e:
            {
                MDXAxesListNode node55 = (MDXAxesListNode)this.ChildNode(0);
                MDXAxisNode     node56 = (MDXAxisNode)this.ChildNode(2);
                node55.Add(node56);
                this.SetSource(node55, 3);
                elem.SetNode(node55);
                return(elem);
            }

            case 0x2f:
            {
                this.ColorKeyword(4);
                MDXExpNode      set    = this.ChildExpNode(1);
                MDXNonEmptyNode node58 = null;
                if (this.ChildNode(0) != null)
                {
                    node58 = this.ChildNode(0) as MDXNonEmptyNode;
                    this.SetSource(node58, 2);
                    node58.SetSet(set);
                    set = node58;
                }
                MDXExpListNode     dimprops = this.ChildNode(3) as MDXExpListNode;
                MDXStringConstNode node60   = (MDXStringConstNode)this.ChildNode(5);
                MDXAxisNode        node61   = new MDXAxisNode(node60.GetString(), set, dimprops, this.ChildExpNode(2));
                this.SetSource(node61, 6);
                elem.SetNode(node61);
                return(elem);
            }

            case 0x31:
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                elem.SetNode(this.ChildNode(2));
                return(elem);

            case 50:
                this.ColorKeyword(0);
                elem.SetNode(this.ChildNode(1));
                return(elem);

            case 0x34:
            {
                this.ColorKeyword(0);
                MDXEmptyNode node109 = new MDXEmptyNode();
                elem.SetNode(node109);
                return(elem);
            }

            case 0x35:
            {
                MDXStringConstNode node72 = new MDXStringConstNode(this.LexChildString(0));
                this.SetSource(node72, 1);
                elem.SetNode(node72);
                return(elem);
            }

            case 0x36:
            {
                MDXStringConstNode node73 = new MDXStringConstNode(this.LexChildString(0));
                this.SetSource(node73, 1);
                elem.SetNode(node73);
                return(elem);
            }

            case 0x37:
            {
                MDXStringConstNode node74 = new MDXStringConstNode(this.LexChildString(2));
                this.SetSource(node74, 4);
                elem.SetNode(node74);
                return(elem);
            }

            case 0x38:
            {
                MDXStringConstNode node62 = new MDXStringConstNode(this.LexChildString(0));
                this.SetSource(node62, 1);
                elem.SetNode(node62);
                return(elem);
            }

            case 0x39:
                elem.SetNode(this.ChildNode(1));
                return(elem);

            case 0x3b:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                MDXNonEmptyNode node111 = new MDXNonEmptyNode();
                elem.SetNode(node111);
                return(elem);
            }

            case 0x3d:
                this.ColorKeyword(0);
                elem.SetNode(this.ChildExpNode(1));
                return(elem);

            case 0x3e:
                elem.SetNode(null);
                return(elem);

            case 0x3f:
            {
                this.ColorKeyword(0);
                MDXWhereNode node63 = new MDXWhereNode();
                node63.Set(this.ChildExpNode(1));
                this.SetSource(node63, 2);
                elem.SetNode(node63);
                return(elem);
            }

            case 0x41:
                this.ColorKeyword(0);
                this.ColorKeyword(1);
                elem.SetNode(this.ChildNode(2));
                return(elem);

            case 0x43:
                this.ColorKeyword(0);
                return(elem);

            case 0x45:
                this.ColorKeyword(0);
                return(elem);

            case 0x47:
                elem.SetNode(this.ChildNode(1));
                return(elem);

            case 0x48:
            {
                MDXIDNode node114 = new MDXIDNode(this.LexChildString(0));
                elem.SetNode(node114);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x49:
            {
                string  term    = this.LexChildString(2);
                MDXNode node115 = this.ChildNode(0);
                node115.CheckType(typeof(MDXIDNode));
                MDXIDNode node116 = (MDXIDNode)node115;
                node116.AppendName(term);
                elem.SetNode(node116);
                this.SetSource(elem.GetNode(), 3);
                return(elem);
            }

            case 0x4a:
                elem.SetNode(this.ChildNode(1));
                this.SetSource(elem.GetNode(), 3);
                return(elem);

            case 0x4b:
            {
                MDXExpListNode list   = (MDXExpListNode)this.ChildNode(1);
                MDXTupleNode   node29 = new MDXTupleNode(list);
                this.SetSource(node29, 3);
                elem.SetNode(node29);
                return(elem);
            }

            case 0x4c:
            {
                MDXExpListNode node30 = (MDXExpListNode)this.ChildNode(1);
                MDXTupleNode   node31 = new MDXTupleNode(node30);
                this.SetSource(node31, 5);
                elem.SetNode(node31);
                return(elem);
            }

            case 0x4d:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 0x4e:
            case 0x4f:
            {
                string             str  = this.LexChildString(0).Remove(0, 1);
                MDXStringConstNode node = new MDXStringConstNode(str.Remove(str.Length - 1, 1))
                {
                    SingleQuote = q_prod == 0x4e
                };
                elem.SetNode(node);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 80:
            {
                MDXParamNode node110 = new MDXParamNode(this.LexChildString(0));
                elem.SetNode(node110);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x51:
            case 0x52:
            case 0x53:
            case 0x54:
            case 0x55:
            {
                MDXExpNode     node2 = this.ChildExpNode(1);
                MDXUnaryOpNode node3 = new MDXUnaryOpNode(this.LexChildString(0), node2);
                elem.SetNode(node3);
                this.SetSource(elem.GetNode(), 2);
                return(elem);
            }

            case 0x56:
            case 0x57:
            case 0x58:
            case 0x59:
            case 90:
            case 0x5b:
            case 0x5c:
            case 0x5d:
            case 0x5e:
            case 0x5f:
            case 0x60:
            case 0x61:
            case 0x62:
            case 0x63:
            case 100:
            case 0x65:
            {
                MDXExpNode   node4 = this.ChildExpNode(0);
                MDXExpNode   node5 = this.ChildExpNode(2);
                MDXBinOpNode node6 = new MDXBinOpNode(this.LexChildString(1), node4, node5);
                this.SetSource(node6, 3);
                elem.SetNode(node6);
                return(elem);
            }

            case 0x66:
            case 0x67:
                this.ColorSome(0, Color.Maroon);
                //this.ColorKeyword(0);
                canonicalName = this.LexChildString(0);
                flag          = MDXParserObjects.s_ObjectsMap.TryGetValue(canonicalName, out obj2);
                if (!flag)
                {
                    canonicalName = StringUtil.CamelCase(canonicalName);
                    break;
                }
                canonicalName = obj2.CanonicalName;
                break;

            case 0x68:
            case 0x69:
            {
                MDXObject      obj4;
                MDXExpNode     node14 = this.ChildExpNode(0);
                string         key    = this.LexChildString(2);
                MDXExpListNode node15 = (MDXExpListNode)this.ChildNode(4);
                if (!MDXParserObjects.s_ObjectsMap.TryGetValue(key, out obj4) || (((obj4.SyntaxForm != MDXSyntaxForm.Method) && ((obj4.SyntaxForm != MDXSyntaxForm.Property) || (obj4.ReturnType != MDXDataType.Set))) && ((obj4.SyntaxForm != MDXSyntaxForm.Property) || (obj4.ReturnType != MDXDataType.Level))))
                {
                    if (node14.GetType() != typeof(MDXIDNode))
                    {
                        Message m = new Message(base.elementFromProduction(2).lexeme())
                        {
                            Text = string.Format("Unrecognized MDX method '{0}'", key)
                        };
                        throw new MDXParserException(m);
                    }
                    key = StringUtil.CamelCase(key);
                    MDXIDNode       node17 = node14 as MDXIDNode;
                    MDXFunctionNode node18 = new MDXFunctionNode(string.Format("{0}.{1}", node17.GetLabel(), key), node15, null, false);
                    this.SetSource(node18, 6);
                    elem.SetNode(node18);
                    return(elem);
                }
                node15.Insert(0, node14);
                MDXPropertyNode node16 = new MDXPropertyNode(obj4.CanonicalName, node15, obj4);
                this.SetSource(node16, 6);
                elem.SetNode(node16);
                return(elem);
            }

            case 0x6a:
            case 0x6b:
            {
                MDXObject  obj3;
                string     str3   = this.LexChildString(2);
                MDXExpNode node10 = this.ChildExpNode(0);
                if (!MDXParserObjects.s_ObjectsMap.TryGetValue(str3, out obj3) || (obj3.SyntaxForm != MDXSyntaxForm.Property))
                {
                    node10.CheckType(typeof(MDXIDNode));
                    MDXIDNode node13 = (MDXIDNode)node10;
                    node13.AppendName(str3);
                    MDXDataType dt = this.m_CubeInfo.DetermineType(node13.GetMDX(-1));
                    node13.SetMDXType(dt);
                    elem.SetNode(node13);
                    this.SetSource(node13, 3);
                    return(elem);
                }
                this.ColorKeyword(2);
                MDXExpListNode args = new MDXExpListNode();
                args.Add(node10);
                MDXPropertyNode node12 = new MDXPropertyNode(obj3.CanonicalName, args, obj3);
                elem.SetNode(node12);
                this.SetSource(node12, 3);
                SSLexLexeme lexeme = base.elementFromProduction(2).lexeme();
                node12.Locator.Line   = lexeme.line() + 1;
                node12.Locator.Column = lexeme.offset() + 1;
                return(elem);
            }

            case 0x6c:
            {
                string str6 = this.LexChildString(0);
                if (!MDXParserObjects.IsFlag(str6))
                {
                    MDXIDNode node20 = new MDXIDNode(str6);
                    elem.SetNode(node20);
                }
                else
                {
                    this.ColorKeyword(0);
                    MDXFlagNode node19 = new MDXFlagNode(str6.ToUpper());
                    elem.SetNode(node19);
                }
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x6d:
            {
                string          str7   = this.LexChildString(0).ToUpper();
                string          str8   = StringUtil.CamelCase(this.LexChildString(2));
                MDXExpListNode  node32 = (MDXExpListNode)this.ChildNode(4);
                MDXFunctionNode node33 = new MDXFunctionNode(string.Format("{0}!{1}", str7, str8), node32, null, false);
                this.SetSource(node33, 6);
                elem.SetNode(node33);
                return(elem);
            }

            case 110:
            {
                MDXExpListNode node34 = (MDXExpListNode)this.ChildNode(1);
                MDXEnumSetNode node35 = new MDXEnumSetNode(node34);
                this.SetSource(node35, 3);
                elem.SetNode(node35);
                return(elem);
            }

            case 0x6f:
            {
                this.ColorKeyword(1);
                MDXExpNode   node112 = this.ChildExpNode(0);
                string       alias   = this.LexChildString(2);
                MDXAliasNode node113 = new MDXAliasNode(node112, alias);
                elem.SetNode(node113);
                this.SetSource(node113, 3);
                return(elem);
            }

            case 0x70:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(4);
                MDXEmptyNode node86 = new MDXEmptyNode();
                elem.SetNode(node86);
                return(elem);
            }

            case 0x71:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(3);
                MDXListNode <MDXWhenNode> whenlist = this.ChildNode(1) as MDXListNode <MDXWhenNode>;
                MDXExpNode  elseexp = this.ChildExpNode(2);
                MDXCaseNode node89  = new MDXCaseNode(whenlist, elseexp);
                elem.SetNode(node89);
                this.SetSource(elem.GetNode(), 4);
                return(elem);
            }

            case 0x72:
            {
                MDXListNode <MDXWhenNode> node90 = new MDXListNode <MDXWhenNode>();
                MDXWhenNode node91 = this.ChildNode(0) as MDXWhenNode;
                node90.Add(node91);
                elem.SetNode(node90);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x73:
            {
                MDXListNode <MDXWhenNode> node92 = this.ChildNode(0) as MDXListNode <MDXWhenNode>;
                MDXWhenNode node93 = this.ChildNode(1) as MDXWhenNode;
                node92.Add(node93);
                elem.SetNode(node92);
                this.SetSource(elem.GetNode(), 2);
                return(elem);
            }

            case 0x74:
            {
                this.ColorKeyword(0);
                this.ColorKeyword(2);
                MDXWhenNode node94 = new MDXWhenNode(this.ChildExpNode(1), this.ChildExpNode(3));
                elem.SetNode(node94);
                this.SetSource(elem.GetNode(), 4);
                return(elem);
            }

            case 0x75:
                elem.SetNode(null);
                return(elem);

            case 0x76:
                this.ColorKeyword(0);
                elem.SetNode(this.ChildNode(1));
                return(elem);

            case 0x77:
            {
                MDXExpListNode node21 = new MDXExpListNode();
                elem.SetNode(node21);
                return(elem);
            }

            case 120:
                elem.SetNode(this.ChildNode(0));
                this.SetSource(elem.GetNode(), 1);
                return(elem);

            case 0x79:
            {
                MDXExpListNode node22 = new MDXExpListNode();
                MDXExpNode     node23 = this.ChildExpNode(0);
                node22.Add(node23);
                this.SetSource(node22, 1);
                elem.SetNode(node22);
                return(elem);
            }

            case 0x7a:
            {
                MDXExpListNode node24 = (MDXExpListNode)this.ChildNode(0);
                MDXExpNode     node25 = this.ChildExpNode(2);
                node24.Add(node25);
                this.SetSource(node24, 3);
                elem.SetNode(node24);
                return(elem);
            }

            case 0x7b:
            {
                MDXExpListNode node26 = (MDXExpListNode)this.ChildNode(0);
                MDXExpNode     node27 = this.ChildExpNode(3);
                node26.Add(new MDXEmptyNode());
                node26.Add(node27);
                this.SetSource(node26, 4);
                elem.SetNode(node26);
                return(elem);
            }

            case 0x7c:
            {
                MDXIntegerConstNode node7 = new MDXIntegerConstNode(this.LexChildString(0));
                elem.SetNode(node7);
                this.SetSource(elem.GetNode(), 1);
                return(elem);
            }

            case 0x7d:
            {
                MDXFloatConstNode node75 = new MDXFloatConstNode(this.LexChildString(0));
                this.SetSource(node75, 1);
                elem.SetNode(node75);
                return(elem);
            }

            default:
                return(elem);
            }
            MDXExpListNode  expList = (MDXExpListNode)this.ChildNode(2);
            MDXFunctionNode node9   = new MDXFunctionNode(canonicalName, expList, obj2, flag);

            this.SetSource(node9, 4);
            elem.SetNode(node9);
            return(elem);
        }
 internal void AddFilter(MDXExpNode filter)
 {
     this.m_Filters.Add(filter);
 }
Exemple #18
0
 internal MDXAliasNode(MDXExpNode exp, string alias)
 {
     this.m_Exp   = exp;
     this.m_Alias = alias;
 }
Exemple #19
0
 internal MDXCaseNode(MDXListNode <MDXWhenNode> whenlist, MDXExpNode elseexp)
 {
     this.m_WhenList = whenlist;
     this.m_Else     = elseexp;
 }
Exemple #20
0
 private void CheckSetForAggregateFunction(MDXExpNode e, Analyzer analyzer)
 {
     if (e.GetMDXType() == MDXDataType.Set)
     {
         Type type = e.GetType();
         if ((type == typeof(MDXFunctionNode)) || (type == typeof(MDXPropertyNode)))
         {
             MDXBaseFunctionNode n = e as MDXBaseFunctionNode;
             if ((((!n.m_Function.Equals("MTD", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("QTD", StringComparison.InvariantCultureIgnoreCase)) && (!n.m_Function.Equals("YTD", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("WTD", StringComparison.InvariantCultureIgnoreCase))) && ((!n.m_Function.Equals("PeriodsToDate", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("AddCalculatedMembers", StringComparison.InvariantCultureIgnoreCase)) && (!n.m_Function.Equals("PeriodsToDate", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("Tail", StringComparison.InvariantCultureIgnoreCase)))) && (((!n.m_Function.Equals("Descendants", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("Distinct", StringComparison.InvariantCultureIgnoreCase)) && (!n.m_Function.Equals("Unorder", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("Hierarchize", StringComparison.InvariantCultureIgnoreCase))) && ((!n.m_Function.Equals("Children", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("MEMBERS", StringComparison.InvariantCultureIgnoreCase)) && (!n.m_Function.Equals("Siblings", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("ALLMEMBERS", StringComparison.InvariantCultureIgnoreCase)))))
             {
                 if (!n.m_Function.Equals("StrToSet", StringComparison.InvariantCultureIgnoreCase))
                 {
                     if ((!n.m_Function.Equals("Except", StringComparison.InvariantCultureIgnoreCase) && !n.m_Function.Equals("Union", StringComparison.InvariantCultureIgnoreCase)) && !n.m_Function.Equals("Intersect", StringComparison.InvariantCultureIgnoreCase))
                     {
                         if (!n.m_Function.Equals("CrossJoin", StringComparison.InvariantCultureIgnoreCase))
                         {
                             Message m = new Message(n)
                             {
                                 Id       = 0x1b,
                                 Severity = 5,
                                 Text     = string.Format("Function '{0}' was used inside aggregation function - this disables block computation mode", n.m_Function),
                                 URL      = "http://msdn.microsoft.com/en-us/library/bb934106.aspx"
                             };
                             analyzer.Add(m);
                         }
                         else
                         {
                             foreach (MDXExpNode node2 in n.m_Arguments)
                             {
                                 this.CheckSetForAggregateFunction(node2, analyzer);
                             }
                         }
                     }
                     else
                     {
                         if (n.m_Arguments.Count > 1)
                         {
                             this.CheckSetForAggregateFunction(n.m_Arguments[0], analyzer);
                         }
                         if (n.m_Arguments.Count > 2)
                         {
                             this.CheckSetForAggregateFunction(n.m_Arguments[1], analyzer);
                         }
                     }
                 }
             }
             else if (n.m_Arguments.Count > 1)
             {
                 this.CheckSetForAggregateFunction(n.m_Arguments[0], analyzer);
             }
         }
         else if (type == typeof(MDXBinOpNode))
         {
             MDXBinOpNode node3 = e as MDXBinOpNode;
             if ((!node3.m_Op.Equals("-") && !node3.m_Op.Equals("*")) && (!node3.m_Op.Equals(":") && !node3.m_Op.Equals("+")))
             {
                 Message message2 = new Message(node3)
                 {
                     Id       = 0x1c,
                     Severity = 5,
                     Text     = string.Format("Operator '{0}' was used inside aggregation function - this disables block computation mode", node3.m_Op),
                     URL      = "http://crawlmsdn.microsoft.com/en-us/library/bb934106(SQL.100).aspx"
                 };
                 analyzer.Add(message2);
             }
             if (!node3.Equals(":"))
             {
                 this.CheckSetForAggregateFunction(node3.m_Exp1, analyzer);
                 this.CheckSetForAggregateFunction(node3.m_Exp2, analyzer);
             }
         }
         else if (type == typeof(MDXUnaryOpNode))
         {
             MDXUnaryOpNode node4 = e as MDXUnaryOpNode;
             if (!node4.m_Op.Equals("-"))
             {
                 Message message3 = new Message(node4)
                 {
                     Id       = 0x1d,
                     Severity = 5,
                     Text     = string.Format("Operator '{0}' was used inside aggregation function - this disables block computation mode", node4.m_Op),
                     URL      = "http://crawlmsdn.microsoft.com/en-us/library/bb934106(SQL.100).aspx"
                 };
                 analyzer.Add(message3);
             }
             this.CheckSetForAggregateFunction(node4.m_Exp, analyzer);
         }
         else if (type == typeof(MDXTupleNode))
         {
             MDXTupleNode node5 = e as MDXTupleNode;
             foreach (MDXExpNode node6 in node5.m_List)
             {
                 this.CheckSetForAggregateFunction(node6, analyzer);
             }
         }
         else if (type == typeof(MDXEnumSetNode))
         {
             MDXEnumSetNode node7 = e as MDXEnumSetNode;
             foreach (MDXExpNode node8 in node7.m_List)
             {
                 this.CheckSetForAggregateFunction(node8, analyzer);
             }
         }
     }
 }
Exemple #21
0
 internal override void Analyze(Analyzer analyzer)
 {
     try
     {
         base.StartAnalyze(analyzer);
         if (!analyzer.InCommonSubExpr)
         {
             base.Analyze(analyzer);
             if (this.m_Object != null)
             {
                 if (this.m_Object.Optimization == MDXFunctionOpt.Deprecated)
                 {
                     Message m = new Message(this)
                     {
                         Id       = 0x12,
                         Text     = string.Format("MDX function '{0}' is deprecated", this.m_Function),
                         Severity = 5
                     };
                     analyzer.Add(m);
                 }
                 else if (this.m_Object.Optimization == MDXFunctionOpt.Bad)
                 {
                     Message message2 = new Message(this)
                     {
                         Id       = 0x13,
                         Text     = string.Format("MDX function '{0}' generaly has very bad performance and should be avoided", this.m_Function),
                         Severity = 5
                     };
                     analyzer.Add(message2);
                 }
                 else if (((this.m_Object.Optimization == MDXFunctionOpt.Normal) && (this.m_Object.ReturnType != MDXDataType.Set)) && analyzer.InRHS)
                 {
                     Message message3 = new Message(this)
                     {
                         Id       = 20,
                         Text     = string.Format("MDX function '{0}' is not optimized for block computation mode", this.m_Function),
                         Severity = 3,
                         URL      = "http://crawlmsdn.microsoft.com/en-us/library/bb934106(SQL.100).aspx"
                     };
                     analyzer.Add(message3);
                 }
             }
             if ((this.m_Function.Equals("Username", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("Member_Caption", StringComparison.InvariantCultureIgnoreCase)) || this.m_Function.Equals("CustomData", StringComparison.InvariantCultureIgnoreCase))
             {
                 Message message4 = new Message(this)
                 {
                     Id       = 0x15,
                     Text     = string.Format("MDX function '{0}' prevents cache sharing between different users", this.m_Function),
                     Severity = 2
                 };
                 analyzer.Add(message4);
             }
             if (this.m_Function.Equals("VisualTotals", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("Axis", StringComparison.InvariantCultureIgnoreCase))
             {
                 Message message5 = new Message(this)
                 {
                     Id       = 0x16,
                     Text     = string.Format("MDX function '{0}' prevents use of global formula engine cache", this.m_Function),
                     Severity = 4
                 };
                 analyzer.Add(message5);
             }
             if (analyzer.InLHS && this.m_Function.Equals("MemberValue", StringComparison.InvariantCultureIgnoreCase))
             {
                 Message message6 = new Message(this)
                 {
                     Id       = 0x17,
                     Text     = string.Format("MDX function '{0}' used in named set or SCOPE prevents use of global formula engine cache", this.m_Function),
                     Severity = 4
                 };
                 analyzer.Add(message6);
             }
             if (((this.m_Function.Equals("Aggregate", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("Sum", StringComparison.InvariantCultureIgnoreCase)) || ((this.m_Function.Equals("Min", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("Max", StringComparison.InvariantCultureIgnoreCase)) || this.m_Function.Equals("Avg", StringComparison.InvariantCultureIgnoreCase))) && (this.m_Arguments.Count > 0))
             {
                 MDXExpNode n = this.m_Arguments[0];
                 if ((n.GetMDXType() != MDXDataType.Set) && (n.GetMDXType() != MDXDataType.Level))
                 {
                     if ((n.GetType() == typeof(MDXIDNode)) && !(n as MDXIDNode).GetLabel().Contains("."))
                     {
                         Message message7 = new Message(this)
                         {
                             Id       = 0x2e,
                             Text     = string.Format("Applying aggregation funciton {0} over named set {1} - this disables block computation mode", this.m_Function, n.GetLabel()),
                             Severity = 1,
                             URL      = "http://msdn.microsoft.com/en-us/library/bb934106.aspx"
                         };
                         analyzer.Add(message7);
                     }
                     else
                     {
                         Message message8 = new Message(n)
                         {
                             Id       = 0x18,
                             Text     = string.Format("It looks like MDX aggregation function '{0}' is called over set with single element. Is that the intent ?", this.m_Function),
                             Severity = 1
                         };
                         analyzer.Add(message8);
                     }
                 }
                 else
                 {
                     this.CheckSetForAggregateFunction(n, analyzer);
                 }
             }
             if ((analyzer.InRHS && !analyzer.IsInExisting()) && ((this.m_Function.Equals("MEMBERS", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("Siblings", StringComparison.InvariantCultureIgnoreCase)) || (this.XofY("Children", ".Parent") || this.XofY("Descendants", ".Parent"))))
             {
                 Message message9 = new Message(this)
                 {
                     Id       = 0x19,
                     Text     = string.Format("This set causes the expression to evaluate to the same value over different coordinates. Consider redirecting to coordinate with non-varying attribute to take advantage of cache", new object[0]),
                     Severity = 2,
                     URL      = "http://sqlblog.com/blogs/mosha/archive/2008/03/28/take-advantage-of-fe-caching-to-optimize-mdx-performance.aspx"
                 };
                 analyzer.Add(message9);
             }
             if (analyzer.InRHS && ((((this.m_Function.Equals("CurrentMember", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("Parent", StringComparison.InvariantCultureIgnoreCase)) || (this.m_Function.Equals("PrevMember", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("NextMember", StringComparison.InvariantCultureIgnoreCase))) || ((this.m_Function.Equals("Lag", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("Lead", StringComparison.InvariantCultureIgnoreCase)) || (this.m_Function.Equals("FirstChild", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("LastChild", StringComparison.InvariantCultureIgnoreCase)))) || (((this.m_Function.Equals("FirstSibling", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("LastSibling", StringComparison.InvariantCultureIgnoreCase)) || (this.m_Function.Equals("ParallelPeriod", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("Cousin", StringComparison.InvariantCultureIgnoreCase))) || (((this.m_Function.Equals("PeriodsToDate", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("YTD", StringComparison.InvariantCultureIgnoreCase)) || (this.m_Function.Equals("QTD", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("MTD", StringComparison.InvariantCultureIgnoreCase))) || ((this.m_Function.Equals("WTD", StringComparison.InvariantCultureIgnoreCase) || this.m_Function.Equals("Ancestor", StringComparison.InvariantCultureIgnoreCase)) || this.m_Function.Equals("Ancestors", StringComparison.InvariantCultureIgnoreCase))))))
             {
                 Message message10 = new Message(this)
                 {
                     Id       = 0x1a,
                     Text     = string.Format("MDX function '{0}' may raise an error or produce non-desired result when user applies multiselect", this.m_Function),
                     Severity = 1,
                     URL      = "http://sqlblog.com/blogs/mosha/archive/2007/01/13/multiselect-friendly-mdx-for-calculations-looking-at-current-coordinate.aspx"
                 };
                 analyzer.Add(message10);
             }
             this.m_Arguments.Analyze(analyzer);
         }
     }
     finally
     {
         base.EndAnalyze(analyzer);
     }
 }
 internal void SetSet(MDXExpNode set)
 {
     this.m_Set = set;
 }
Exemple #23
0
 internal MDXCalcPropNode(string propname, MDXExpNode exp)
 {
     this.m_PropName = propname;
     this.m_PropExp  = exp;
 }
Exemple #24
0
 internal MDXWhenNode(MDXExpNode when, MDXExpNode then)
 {
     this.m_When = when;
     this.m_Then = then;
 }
Exemple #25
0
 internal override bool IsCacheTrivial()
 {
     return((this.m_Arguments.Count == 0) || ((base.GetType() == typeof(MDXPropertyNode)) && MDXExpNode.IsCachePrimitive(this.m_Arguments[0])));
 }
Exemple #26
0
 internal MDXScopeNode(MDXExpNode scope, MDXScriptNode script, MDXEndScopeNode endscope)
 {
     this.m_Scope    = scope;
     this.m_Script   = script;
     this.m_EndScope = endscope;
 }
Exemple #27
0
 internal void Set(MDXExpNode exp)
 {
     this.m_Exp = exp;
 }