private DataObject EvaluateBinary(DataObject left, SqlExpressionType binaryType, DataObject right)
        {
            if (binaryType.IsAll())
                return left.Any(binaryType.SubQueryPlainType(), right, context);
            if (binaryType.IsAny())
                return left.All(binaryType.SubQueryPlainType(), right, context);

            switch (binaryType) {
                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.Modulus(right);
                case SqlExpressionType.GreaterThan:
                    return left.IsGreaterThan(right);
                case SqlExpressionType.GreaterOrEqualThan:
                    return left.IsGreterOrEqualThan(right);
                case SqlExpressionType.SmallerThan:
                    return left.IsSmallerThan(right);
                case SqlExpressionType.SmallerOrEqualThan:
                    return left.IsSmallerOrEqualThan(right);
                case SqlExpressionType.Equal:
                    return left.IsEqualTo(right);
                case SqlExpressionType.NotEqual:
                    return left.IsNotEqualTo(right);
                case SqlExpressionType.Is:
                    return left.Is(right);
                case SqlExpressionType.IsNot:
                    return left.IsNot(right);
                case SqlExpressionType.Like:
                    return left.IsLike(right);
                case SqlExpressionType.NotLike:
                    return left.IsNotLike(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 ExpressionEvaluateException(String.Format("The type {0} is not a binary expression or is not supported.", binaryType));
            }
        }
示例#2
0
        private DataObject EvaluateBinary(DataObject left, SqlExpressionType binaryType, DataObject right)
        {
            if (binaryType.IsAll())
            {
                return(left.Any(binaryType.SubQueryPlainType(), right, context));
            }
            if (binaryType.IsAny())
            {
                return(left.All(binaryType.SubQueryPlainType(), right, context));
            }

            switch (binaryType)
            {
            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.Modulus(right));

            case SqlExpressionType.GreaterThan:
                return(left.IsGreaterThan(right));

            case SqlExpressionType.GreaterOrEqualThan:
                return(left.IsGreterOrEqualThan(right));

            case SqlExpressionType.SmallerThan:
                return(left.IsSmallerThan(right));

            case SqlExpressionType.SmallerOrEqualThan:
                return(left.IsSmallerOrEqualThan(right));

            case SqlExpressionType.Equal:
                return(left.IsEqualTo(right));

            case SqlExpressionType.NotEqual:
                return(left.IsNotEqualTo(right));

            case SqlExpressionType.Is:
                return(left.Is(right));

            case SqlExpressionType.IsNot:
                return(left.IsNot(right));

            case SqlExpressionType.Like:
                return(left.IsLike(right));

            case SqlExpressionType.NotLike:
                return(left.IsNotLike(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 ExpressionEvaluateException(String.Format("The type {0} is not a binary expression or is not supported.", binaryType));
            }
        }