private string Base(Expression exp) { var cached = (CachedExpression)exp; if (cached.Sql != null) { return(cached.Sql); } cached.Sql = exp switch { UnionExpression e => Union(e), SelectExpression e => Select(e), WhereExpression e => Where(e), MaxExpression e => Max(e), MinExpression e => Min(e), SumExpression e => Sum(e), CountExpression e => Count(e), TakeExpression e => Take(e), SkipExpression e => Skip(e), FirstExpression e => First(e), DistinctExpression e => Distinct(e), OrderByExpression e => OrderBy(e), OrderByDescendingExpression e => OrderByDescending(e), _ => throw new InvalidEnumArgumentException() }; return(cached.Sql); }
private static Expression HandleMax(HandlerContext handlerContext) { var maxExpression = new MaxExpression(handlerContext.SelectExpression.Projection.Single()); handlerContext.SelectExpression.SetProjectionExpression(maxExpression); return((Expression)_transformClientExpressionMethodInfo .MakeGenericMethod(maxExpression.Type) .Invoke(null, new object[] { handlerContext })); }
public Completion Max(object a, object b) { ExecutionEnvironment e = new ExecutionEnvironment(); e.RegisterValue("a", a); e.RegisterValue("b", b); MaxExpression abs = new MaxExpression(); abs.Args[0] = new Identifier("a"); abs.Args[1] = new Identifier("b"); return(abs.Execute(e)); }
public virtual Expression VisitMaxExpression(MaxExpression maxExpression) { Check.NotNull(maxExpression, "maxExpression"); _sql.Append("MAX("); VisitExpression(maxExpression.ColumnExpression); _sql.Append(")"); return(maxExpression); }
public virtual Expression VisitMax(MaxExpression maxExpression) { Check.NotNull(maxExpression, nameof(maxExpression)); _sql.Append("MAX("); Visit(maxExpression.Expression); _sql.Append(")"); return(maxExpression); }
public virtual Expression VisitMax(MaxExpression maxExpression) { Check.NotNull(maxExpression, nameof(maxExpression)); _relationalCommandBuilder.Append("MAX("); Visit(maxExpression.Expression); _relationalCommandBuilder.Append(")"); return(maxExpression); }
private string Max(MaxExpression exp) => $"SELECT MAX({Secondary.Serialize(exp.Selector.Body)}) FROM ({Serialize(exp.Sub)}) AS this";