public override CosmosElement Visit(SqlCoalesceScalarExpression scalarExpression, CosmosElement document) { CosmosElement left = scalarExpression.Left.Accept(this, document); CosmosElement right = scalarExpression.Right.Accept(this, document); return(left != Undefined ? left : right); }
public override int Visit(SqlCoalesceScalarExpression sqlCoalesceScalarExpression) { int hashCode = SqlCoalesceScalarExpressionHashCode; hashCode = CombineHashes(hashCode, sqlCoalesceScalarExpression.Left.Accept(this)); hashCode = CombineHashes(hashCode, sqlCoalesceScalarExpression.Right.Accept(this)); return(hashCode); }
public override void Visit(SqlCoalesceScalarExpression sqlCoalesceScalarExpression) { this.writer.Write("("); sqlCoalesceScalarExpression.Left.Accept(this); this.writer.Write(" ?? "); sqlCoalesceScalarExpression.Right.Accept(this); this.writer.Write(")"); }
public override SqlObject VisitCoalesceScalarExpression([NotNull] sqlParser.CoalesceScalarExpressionContext context) { Contract.Requires(context != null); // scalar_expression '??' scalar_expression SqlScalarExpression left = (SqlScalarExpression)this.Visit(context.scalar_expression(0)); SqlScalarExpression right = (SqlScalarExpression)this.Visit(context.scalar_expression(1)); return(SqlCoalesceScalarExpression.Create(left, right)); }
public override bool Visit(SqlCoalesceScalarExpression first, SqlObject secondAsObject) { if (!(secondAsObject is SqlCoalesceScalarExpression second)) { return(false); } if (!Equals(first.Left, second.Left)) { return(false); } if (!Equals(first.Right, second.Right)) { return(false); } return(true); }
public void SqlCoalesceScalarExpressionTest() { SqlLiteralScalarExpression nullLiteral = SqlLiteralScalarExpression.Create(SqlNullLiteral.Singleton); SqlLiteralScalarExpression undefinedLiteral = SqlLiteralScalarExpression.Create(SqlUndefinedLiteral.Create()); SqlLiteralScalarExpression five = SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(5)); SqlLiteralScalarExpression three = SqlLiteralScalarExpression.Create(SqlNumberLiteral.Create(3)); SqlCoalesceScalarExpression nullCoalesceFive = SqlCoalesceScalarExpression.Create(nullLiteral, five); AssertEvaluation(CosmosNull.Create(), nullCoalesceFive); SqlCoalesceScalarExpression undefinedCoalesceFive = SqlCoalesceScalarExpression.Create(undefinedLiteral, five); AssertEvaluation(CosmosNumber64.Create(5), undefinedCoalesceFive); SqlCoalesceScalarExpression threeCoalesceFive = SqlCoalesceScalarExpression.Create(three, five); AssertEvaluation(CosmosNumber64.Create(3), threeCoalesceFive); }
public override bool Visit(SqlCoalesceScalarExpression scalarExpression) { if (this.MatchesGroupByExpression(scalarExpression)) { return(true); } if (!scalarExpression.Left.Accept(this)) { return(false); } if (!scalarExpression.Right.Accept(this)) { return(false); } return(true); }
public abstract void Visit(SqlCoalesceScalarExpression sqlObject);
public override SqlObject Visit(SqlCoalesceScalarExpression sqlCoalesceScalarExpression) { return(SqlCoalesceScalarExpression.Create( sqlCoalesceScalarExpression.Left.Accept(this) as SqlScalarExpression, sqlCoalesceScalarExpression.Right.Accept(this) as SqlScalarExpression)); }
public abstract void Visit(SqlCoalesceScalarExpression scalarExpression);
public override bool Visit(SqlCoalesceScalarExpression sqlCoalesceScalarExpression) { return(sqlCoalesceScalarExpression.Left.Accept(this) || sqlCoalesceScalarExpression.Right.Accept(this)); }
public abstract TResult Visit(SqlCoalesceScalarExpression sqlObject);
public abstract TOutput Visit(SqlCoalesceScalarExpression sqlObject, TArg input);
public abstract TResult Visit(SqlCoalesceScalarExpression scalarExpression);