Esempio n. 1
0
            private void CheckJoinCondition(SqlExpression expr)
            {
                switch (expr.NodeType)
                {
                case SqlNodeType.And: {
                    SqlBinary b = (SqlBinary)expr;
                    CheckJoinCondition(b.Left);
                    CheckJoinCondition(b.Right);
                    break;
                }

                case SqlNodeType.EQ:
                case SqlNodeType.EQ2V: {
                    SqlBinary    b       = (SqlBinary)expr;
                    SqlColumnRef crLeft  = b.Left as SqlColumnRef;
                    SqlColumnRef crRight = b.Right as SqlColumnRef;
                    if (crLeft != null && crRight != null)
                    {
                        SqlColumn cLeft  = crLeft.GetRootColumn();
                        SqlColumn cRight = crRight.GetRootColumn();
                        this.map[cLeft]  = cRight;
                        this.map[cRight] = cLeft;
                    }
                    break;
                }
                }
            }
Esempio n. 2
0
            internal bool AreEquivalent(SqlExpression e1, SqlExpression e2)
            {
                if (SqlComparer.AreEqual(e1, e2))
                {
                    return(true);
                }

                SqlColumnRef cr1 = e1 as SqlColumnRef;
                SqlColumnRef cr2 = e2 as SqlColumnRef;

                if (cr1 != null && cr2 != null)
                {
                    SqlColumn c1 = cr1.GetRootColumn();
                    SqlColumn c2 = cr2.GetRootColumn();
                    SqlColumn r;
                    return(this.map.TryGetValue(c1, out r) && r == c2);
                }

                return(false);
            }