public void Visit(GreaterThanOrEqualsOperator op)
 {
     _conditionWriter.WriteStartElement("ge");
     op.Left.Visit(this);
     op.Right.Visit(this);
     _conditionWriter.WriteEndElement();
 }
예제 #2
0
 public virtual IExpression Clone(GreaterThanOrEqualsOperator op)
 {
     return(new GreaterThanOrEqualsOperator()
     {
         Left = CloneAndReturn(op.Left),
         Right = CloneValue(op.Left, op.Right)
     }.Normalize());
 }
예제 #3
0
 public virtual void Visit(GreaterThanOrEqualsOperator op)
 {
     AddParenthesesIfNeeded(op, () =>
     {
         op.Left.Visit(this);
         Writer.Write(" >= ");
         op.Right.Visit(this);
     });
 }
예제 #4
0
 public void Visit(GreaterThanOrEqualsOperator op)
 {
     AddParenthesesIfNeeded(op, () =>
     {
         op.Left.Visit(this);
         WriteEncoded(" ge ");
         op.Right.Visit(this);
     });
 }
예제 #5
0
 public virtual void Visit(GreaterThanOrEqualsOperator op)
 {
     op.Left.Visit(this);
     op.Right.Visit(this);
 }
예제 #6
0
 void IExpressionVisitor.Visit(GreaterThanOrEqualsOperator op)
 {
     _clone = Clone(op);
 }
예제 #7
0
        /// <summary>Closes one element and pops the corresponding namespace scope.</summary>
        /// <exception cref="InvalidOperationException">This results in an invalid XML document.</exception>
        /// <exception cref="InvalidOperationException">An <see cref="XmlWriter" /> method was called before a previous asynchronous operation finished. In this case, <see cref="InvalidOperationException" /> is thrown with the message “An asynchronous operation is already in progress.”</exception>
        public override void WriteEndElement()
        {
            if (_stack.Count > 0)
            {
                var value = _buffer.ToString() ?? "";
                _buffer.Length = 0;

                var last = _stack.Pop();
                if (_attrBuffer.TryGetValue(ParameterSubstitution.DateRangeAttribute, out var dateRange) &&
                    ParameterSubstitution.TryDeserializeDateRange(dateRange, out var dateStart, out var dateEnd) &&
                    (dateStart.HasValue || dateEnd.HasValue))
                {
                    var property = (last as BinaryOperator)?.Left ?? (last as BetweenOperator)?.Left;
                    if (property == null)
                    {
                        throw new NotSupportedException();
                    }

                    if (dateStart.HasValue && dateEnd.HasValue)
                    {
                        last = new BetweenOperator()
                        {
                            Left = property,
                            Min  = new DateOffsetLiteral(_context, dateStart.Value, false),
                            Max  = new DateOffsetLiteral(_context, dateEnd.Value, true),
                        }.Normalize();
                    }
                    else if (dateStart.HasValue)
                    {
                        last = new GreaterThanOrEqualsOperator()
                        {
                            Left  = property,
                            Right = new DateOffsetLiteral(_context, dateStart.Value, false)
                        }.Normalize();
                    }
                    else
                    {
                        last = new LessThanOrEqualsOperator()
                        {
                            Left  = property,
                            Right = new DateOffsetLiteral(_context, dateEnd.Value, true)
                        }.Normalize();
                    }
                }
                else
                {
                    if (last is IsOperator isOp)
                    {
                        switch (value)
                        {
                        case "defined":
                            isOp.Right = IsOperand.Defined;
                            break;

                        case "not defined":
                            isOp.Right = IsOperand.NotDefined;
                            break;

                        case "not null":
                            isOp.Right = IsOperand.NotNull;
                            break;

                        case "null":
                            isOp.Right = IsOperand.Null;
                            break;

                        case "":
                            break;

                        default:
                            throw new NotSupportedException();
                        }
                    }
                    else if (last is InOperator inOp)
                    {
                        inOp.Right = ListExpression.FromSqlInClause(value);
                    }
                    else if (last is BetweenOperator betweenOp)
                    {
                        betweenOp.SetMinMaxFromSql(value);
                    }
                    else if (last is PropertyReference property)
                    {
                        if (_stack.OfType <Join>().Last().Right.Joins.Any(j => j.Right.TypeProvider == property))
                        {
                            last = null;
                        }
                        else
                        {
                            last = new EqualsOperator()
                            {
                                Left = property
                            };
                        }
                    }

                    if (!(last is ILogical) && last is BinaryOperator binOp)
                    {
                        if (value == "__now()")
                        {
                            binOp.Right = new Functions.CurrentDateTime();
                        }
                        else if (binOp is LikeOperator)
                        {
                            binOp.Right = AmlLikeParser.Instance.Parse(value);
                        }
                        else
                        {
                            binOp.Right = NormalizeLiteral((PropertyReference)binOp.Left, value, _context);
                        }
                    }
                }

                if (last is BinaryOperator genOp &&
                    genOp.Left is PropertyReference prop &&
                    (prop.Name == "generation" || prop.Name == "id"))
                {
                    Query.Version = new VersionCriteria()
                    {
                        Condition = genOp
                    };
                    if (prop.Name == "id")
                    {
                        AddToCondition(genOp);
                    }
                }