internal override void Analyze(Analyzer analyzer) { base.Analyze(analyzer); if (this.m_Prop != null) { if (this.m_Prop.Equals("NON_EMPTY_BEHAVIOR", StringComparison.InvariantCultureIgnoreCase)) { Message m = new Message(this) { Id = 7, Text = string.Format("AS2008 only: Consider removing NON_EMPTY_BEHAVIOR property", new object[0]), Severity = 2 }; analyzer.Add(m); } else { Type t = this.m_RValue.GetType(); if (!MDXNode.IsConstantNode(t) && (t != typeof(MDXIDNode))) { Message message2 = new Message(this) { Id = 8, Text = string.Format("Calculation property '{0}' is not a constant or member reference. Therefore it will not benefit from neiter block computation mode, nor caching", this.m_Prop), Severity = 4 }; analyzer.Add(message2); } } } try { analyzer.InLHS = true; this.m_LValue.Analyze(analyzer); } finally { analyzer.InLHS = false; } try { analyzer.InRHS = true; this.m_RValue.Analyze(analyzer); } finally { analyzer.InRHS = false; } if ((this.m_Prop == null) && (this.m_RValue.GetMDXType() == MDXDataType.String)) { Message message3 = new Message(this.m_RValue) { Id = 9, Text = string.Format("RHS of the assignment evaluates to a string. Strings are difficult to cache - consider using FORMAT_STRING property for value formatting", new object[0]), Severity = 2 }; analyzer.Add(message3); } }
internal override void Analyze(Analyzer analyzer) { base.Analyze(analyzer); if (this.m_ExpressionUsedSingleQuotes) { Message m = new Message(this.m_Exp) { Id = 1, Text = string.Format("Don't use single quotes for definitions of calculation {0}", this.m_Name.GetLabel()), Severity = 0, URL = "http://sqlblog.com/blogs/mosha/archive/2005/04/02/to-quote-or-not-to-quote-in-expressions-of-mdx-calculations.aspx" }; analyzer.Add(m); } if (this.m_CalcProps != null) { foreach (MDXCalcPropNode node in this.m_CalcProps) { if (node.PropertyName.Equals("NON_EMPTY_BEHAVIOR", StringComparison.InvariantCultureIgnoreCase)) { Message message2 = new Message(node) { Id = 2, Text = string.Format("AS2008 only: Consider removing NON_EMPTY_BEHAVIOR property for '{0}'", this.m_Name.GetLabel()), Severity = 2 }; analyzer.Add(message2); } else { Type t = node.PropertyExp.GetType(); if ((!node.PropertyName.Equals("SOLVE_ORDER", StringComparison.InvariantCultureIgnoreCase) && !MDXNode.IsConstantNode(t)) && (t != typeof(MDXIDNode))) { Message message3 = new Message(node) { Id = 3, Text = string.Format("Calculation property '{0}' of '{1}' is not a constant or member reference. Therefore it will not benefit from neiter block computation mode, nor caching", node.PropertyName, this.m_Name.GetLabel()), Severity = 4 }; analyzer.Add(message3); } } if (node.PropertyName.Equals("VISIBLE", StringComparison.InvariantCultureIgnoreCase)) { Message message4 = new Message(node) { Id = 4, Severity = 0, URL = "http://technet.microsoft.com/en-us/library/ms144787(SQL.100).aspx" }; if (node.PropertyExp.GetLabel().Equals("0") || node.PropertyExp.GetLabel().Equals("false", StringComparison.InvariantCultureIgnoreCase)) { message4.Text = "Consider using 'CREATE HIDDEN ...' syntax instead of ',VISIBLE=0'"; } else { message4.Text = string.Format("'VISIBLE={0}' is redundant, since {1} is visible by default", node.PropertyExp.GetMDX(-1), this.m_Name.GetLabel()); } analyzer.Add(message4); } node.PropertyExp.Analyze(analyzer); } } }