Exemple #1
0
        public override void PerformAfter(SwitchFunction node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            m_inMSAccessSwitch = false;
            m_sql.Append(')');
        }
Exemple #2
0
        public override void PerformBefore(SwitchFunction node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node");
            }

            m_sql.Append("Switch(");
            m_inMSAccessSwitch = true;
        }
Exemple #3
0
        SwitchFunction MakeSwitch(CaseExpression caseExpr)
        {
            if (caseExpr == null)
            {
                throw new ArgumentNullException("caseExpr");
            }

            IExpression    left       = caseExpr.Case;
            SwitchFunction switchFunc = new SwitchFunction();

            CaseAlternative alt = caseExpr.Alternatives;

            if (alt == null)
            {
                throw new InvalidOperationException("CASE has no alternatives.");
            }

            // branch expressions will be tailored through caseExpr.Alternatives

            if (left != null)
            {
                while (alt != null)
                {
                    alt.When = new Expression(left.Clone(), ExpressionOperator.Equal,
                                              alt.When);

                    CaseAlternative next = alt.Next;
                    alt.Next = null;
                    switchFunc.Add(alt);

                    alt = next;
                }
            }
            else
            {
                switchFunc.Alternatives = alt;
            }

            IExpression elseExpr = caseExpr.Else;

            if (elseExpr != null)
            {
                // elseExpr will be tailored through caseExpr.Else

                CaseAlternative last = new CaseAlternative(
                    new Expression(
                        new IntegerValue(1),
                        ExpressionOperator.Equal,
                        new IntegerValue(1)),
                    elseExpr);
                switchFunc.Add(last);
            }

            return(switchFunc);
        }
Exemple #4
0
        public INode Clone()
        {
            SwitchFunction switchFunction = new SwitchFunction();

            if (m_alternatives != null)
            {
                switchFunction.Alternatives = (CaseAlternative)(m_alternatives.Clone());
            }

            return(switchFunction);
        }
Exemple #5
0
 public virtual void PerformAfter(SwitchFunction node)
 {
 }
Exemple #6
0
 public virtual void PerformBefore(SwitchFunction node)
 {
 }
Exemple #7
0
 public override void PerformAfter(SwitchFunction node)
 {
     PopKnownParent(node);
 }
Exemple #8
0
 public override void PerformBefore(SwitchFunction node)
 {
     PushParent(node);
 }