예제 #1
0
        //public abstract bool EqualTo(SqlExpression other, SqlEqualityTestProps props);

        public bool FlatEqualTo(SqlExpression other, SqlEqualityTestProps props)
        {
            List <SqlExprRef> my = new List <SqlExprRef>(), ol = new List <SqlExprRef>();

            GetFlatList(my);
            other.GetFlatList(ol);
            return(my.EqualSequence(ol, (a, b) => a.EqualTo(b, props)));
        }
예제 #2
0
 public bool EqualTo(SqlExprRef other, SqlEqualityTestProps props)
 {
     if (StringData != null)
     {
         return(other.StringData != null && StringData == other.StringData);
     }
     if (NumData != null)
     {
         return(other.NumData != null && NumData == other.NumData);
     }
     if (Select != null)
     {
         return(other.Select != null && Select.EqualTo(other.Select, props));
     }
     if (Operator != null)
     {
         return(other.Operator != null && Operator.ToLower() == other.Operator.ToLower());
     }
     if (Identifier != null)
     {
         return(other.Identifier != null && Identifier.ToLower() == other.Identifier.ToLower());
     }
     if (IsNull)
     {
         return(other.IsNull);
     }
     if (CallExpr != null)
     {
         return(other.CallExpr != null && CallExpr.EqualTo(other.CallExpr, props));
     }
     if (ExprList != null)
     {
         if (other.ExprList == null)
         {
             return(false);
         }
         if (other.ExprList.Count != ExprList.Count)
         {
             return(false);
         }
         for (int i = 0; i < ExprList.Count; i++)
         {
             if (!((SqlExpression)ExprList[i]).FlatEqualTo((SqlExpression)other.ExprList[i], props))
             {
                 return(false);
             }
         }
         return(true);
     }
     if (SpecConst != null)
     {
         return(other.SpecConst != null && SpecConst == other.SpecConst);
     }
     return(false);
 }
예제 #3
0
 public bool EqualTo(SqlSelect other, SqlEqualityTestProps props)
 {
     if (!ResultFields.EqualSequence(other.ResultFields, (a, b) => a.EqualTo(b, props)))
     {
         return(false);
     }
     if (!Clauses.EqualSequence(other.Clauses, (a, b) => a.EqualTo(b, props)))
     {
         return(false);
     }
     return(true);
 }
예제 #4
0
 public static bool Equals(SqlMultiKeyWord a, SqlMultiKeyWord b, SqlEqualityTestProps props)
 {
     if (a == null)
     {
         return(b == null);
     }
     if (b == null)
     {
         return(a == null);
     }
     return(a.ClauseWords.CreateDelimitedText(" ").ToLower() == b.ClauseWords.CreateDelimitedText(" ").ToLower());
 }
예제 #5
0
 public bool EqualTo(SqlFunctionCall other, SqlEqualityTestProps props)
 {
     if (!FunctionName.EqualTo(other.FunctionName, props))
     {
         return(false);
     }
     if (!Arguments.Items.EqualSequence(other.Arguments.Items, (a, b) => a.Argument.FlatEqualTo(b.Argument, props)))
     {
         return(false);
     }
     return(true);
 }
예제 #6
0
        public override bool EqualTo(SqlCommandClause clause, SqlEqualityTestProps props)
        {
            var o = clause as SqlConditionClause;

            if (o == null)
            {
                return(false);
            }
            if (o.GetType() != GetType())
            {
                return(false);
            }
            return(Condition.FlatEqualTo(o.Condition, props));
        }
예제 #7
0
        public override bool EqualTo(SqlCommandClause clause, SqlEqualityTestProps props)
        {
            var o = clause as SqlColumnListClause;

            if (o == null)
            {
                return(false);
            }
            if (o.GetType() != GetType())
            {
                return(false);
            }
            return(Items.EqualTo(o.Items, props));
        }
예제 #8
0
        public override bool EqualTo(SqlCommandClause clause, SqlEqualityTestProps props)
        {
            var c = clause as SqlFromClause;

            if (c == null)
            {
                return(false);
            }
            List <SqlJoinRef> myl = new List <SqlJoinRef>(), otherl = new List <SqlJoinRef>();

            Source.GetFlatList(myl);
            c.Source.GetFlatList(otherl);
            return(myl.EqualSequence(otherl, (a, b) => a.EqualTo(b, props)));
        }
예제 #9
0
 public bool EqualTo(SqlJoinRef other, SqlEqualityTestProps props)
 {
     if (JoinType != null)
     {
         return(other.JoinType != null && EqualJoinTypes(JoinType, other.JoinType, props));
     }
     if (Source != null)
     {
         return(other.Source != null && Source.FlatEqualTo(other.Source, props));
     }
     if (Condition != null)
     {
         return(other.Condition != null && Condition.FlatEqualTo(other.Condition, props));
     }
     return(false);
 }
예제 #10
0
 public static bool EqualJoinTypes(string j1, string j2, SqlEqualityTestProps props)
 {
     j1 = j1.ToLower();
     j2 = j2.ToLower();
     if (TryEq(j1, j2, ",", "cross join"))
     {
         return(true);
     }
     if (TryEq(j1, j2, "join", "inner join"))
     {
         return(true);
     }
     if (TryEq(j1, j2, "left join", "left outer join"))
     {
         return(true);
     }
     if (TryEq(j1, j2, "right join", "right outer join"))
     {
         return(true);
     }
     return(j1 == j2);
 }
예제 #11
0
 public bool EqualTo(SqlResultField other, SqlEqualityTestProps props)
 {
     return(Value.FlatEqualTo(other.Value, props));
 }
예제 #12
0
 public abstract bool EqualTo(SqlCommandClause clause, SqlEqualityTestProps props);
예제 #13
0
        public bool EqualTo(SqlColRefList other, SqlEqualityTestProps props)
        {
            return(Items.EqualSequence(other.Items, (a, b) => a.Argument.FlatEqualTo(b.Argument, props) && SqlMultiKeyWord.Equals(a.Modifier, b.Modifier, props)));

            throw new NotImplementedError("DAE-00116");
        }
예제 #14
0
 public virtual bool EqualTo(SqlNameExpression other, SqlEqualityTestProps props)
 {
     return(NameWithoutQualifiers == other.NameWithoutQualifiers);
 }