private SqlObject Relational(SqlExpressionType opType, SqlObject a, SqlObject b) { switch (opType) { case SqlExpressionType.Equal: return(a.Equal(b)); case SqlExpressionType.NotEqual: return(a.NotEqual(b)); case SqlExpressionType.GreaterThan: return(a.GreaterThan(b)); case SqlExpressionType.LessThan: return(a.LessThan(b)); case SqlExpressionType.GreaterThanOrEqual: return(a.GreaterThanOrEqual(b)); case SqlExpressionType.LessThanOrEqual: return(a.LessOrEqualThan(b)); case SqlExpressionType.Is: return(a.Is(b)); case SqlExpressionType.IsNot: return(a.IsNot(b)); default: return(SqlObject.Unknown); } }
private SqlObject ReduceBinary(SqlObject left, SqlObject right) { switch (ExpressionType) { case SqlExpressionType.Add: return(left.Add(right)); case SqlExpressionType.Subtract: return(left.Subtract(right)); case SqlExpressionType.Multiply: return(left.Multiply(right)); case SqlExpressionType.Divide: return(left.Divide(right)); case SqlExpressionType.Modulo: return(left.Modulo(right)); case SqlExpressionType.GreaterThan: return(left.GreaterThan(right)); case SqlExpressionType.GreaterThanOrEqual: return(left.GreaterThanOrEqual(right)); case SqlExpressionType.LessThan: return(left.LessThan(right)); case SqlExpressionType.LessThanOrEqual: return(left.LessOrEqualThan(right)); case SqlExpressionType.Equal: return(left.Equal(right)); case SqlExpressionType.NotEqual: return(left.NotEqual(right)); case SqlExpressionType.Is: return(left.Is(right)); case SqlExpressionType.IsNot: return(left.IsNot(right)); case SqlExpressionType.And: return(left.And(right)); case SqlExpressionType.Or: return(left.Or(right)); case SqlExpressionType.XOr: return(left.XOr(right)); // TODO: ANY and ALL default: throw new SqlExpressionException($"The type {ExpressionType} is not a binary expression or is not supported."); } }