public bool VisitExprSelectOffsetFetch(ExprSelectOffsetFetch expr, TCtx arg) { var res = this.Visit(expr, "SelectOffsetFetch", arg, out var argOut) && this.Accept("SelectQuery", expr.SelectQuery, argOut) && this.Accept("OrderBy", expr.OrderBy, argOut); this._visitor.EndVisitExpr(expr, arg); return(res); }
public bool VisitExprSelectOffsetFetch(ExprSelectOffsetFetch exprSelectOffsetFetch, IExpr?parent) { exprSelectOffsetFetch.SelectQuery.Accept(this, exprSelectOffsetFetch); this.Builder.Append(" ORDER BY "); exprSelectOffsetFetch.OrderBy.Accept(this, exprSelectOffsetFetch); return(true); }
public static async Task <DataPage <T> > QueryPage <T>(this ExprSelectOffsetFetch query, ISqDatabase database, Func <ISqDataRecordReader, T> reader) { var countColumn = CustomColumnFactory.Int32("$count$"); var selectQuery = (ExprQuerySpecification)query.SelectQuery; query = query.WithSelectQuery( selectQuery.WithSelectList(selectQuery.SelectList.Concat(SqQueryBuilder.CountOneOver().As(countColumn)))); var res = await query.Query(database, new KeyValuePair <List <T>, int?>(new List <T>(), null), (acc, r) => { acc.Key.Add(reader(r)); var total = acc.Value ?? countColumn.Read(r); return(new KeyValuePair <List <T>, int?>(acc.Key, total)); }); return(new DataPage <T>(res.Key, query.OrderBy.OffsetFetch.Offset.Value ?? 0, res.Value ?? 0)); }
public static ExprSelectOffsetFetch WithCrossJoin(this ExprSelectOffsetFetch select, IExprTableSource tableSource) => select.SelectQuery is ExprQuerySpecification specification
public static ExprSelectOffsetFetch WithFullJoin(this ExprSelectOffsetFetch select, IExprTableSource tableSource, ExprBoolean on) => select.SelectQuery is ExprQuerySpecification specification
public static ExprSelectOffsetFetch WithOrderBy(this ExprSelectOffsetFetch original, ExprOrderByOffsetFetch newOrderBy) => new ExprSelectOffsetFetch(selectQuery: original.SelectQuery, orderBy: newOrderBy);
public static ExprSelectOffsetFetch WithSelectQuery(this ExprSelectOffsetFetch original, IExprSubQuery newSelectQuery) => new ExprSelectOffsetFetch(selectQuery: newSelectQuery, orderBy: original.OrderBy);
internal ModelRangeRequestData(ExprSelectOffsetFetch expr, Func <ISqDataRecordReader, TRes> mapper) { this.Expr = expr; this.Mapper = mapper; }