public void BuildingClauseWhenOrderByOrSkipIsNotDefined() { var data = new Dictionary <string, string>(); var result = OffsetClause.Build(new ODataOptions <Model>(data)); result.Should().BeEmpty(); }
public override void ExplicitVisit(OffsetClause node) { if (node.OffsetExpression.FirstNoneParenthesisExpression() is Literal || node.FetchExpression.FirstNoneParenthesisExpression() is Literal) { IsSuspected = true; } base.ExplicitVisit(node); }
public void BuildingClauseWhenSkipIsDefined() { var data = new Dictionary <string, string> { ["$orderby"] = "Id desc", ["$skip"] = "20" }; var result = OffsetClause.Build(new ODataOptions <Model>(data)); result.Should().Be("OFFSET 20 ROWS"); }
public void BuildingClauseWhenSkipAndTopAreDefined() { var data = new Dictionary <string, string> { ["$orderby"] = "Id desc", ["$skip"] = "40", ["$top"] = "20" }; var result = OffsetClause.Build(new ODataOptions <Model>(data)); result.Should().Be("OFFSET 40 ROWS FETCH NEXT 20 ROWS ONLY"); }
public SingleSeriesSelectStatement( SelectClause select, FromClause from, WhereClause where = null, GroupByClause groupBy = null, FillClause fill = null, OrderByClause orderBy = null, LimitClause limit = null, OffsetClause offset = null ) { Select = select ?? throw new ArgumentNullException(nameof(select)); From = from ?? throw new ArgumentNullException(nameof(from)); Where = where; GroupBy = groupBy; Fill = fill; OrderBy = orderBy; Limit = limit; Offset = offset; }
public QsiLimitExpressionNode VisitLimitOffset(TopRowFilter topRowFilter, OffsetClause offsetClause) { return(TreeHelper.Create <QsiLimitExpressionNode>(n => { if (topRowFilter != null) { var topRowFilterNode = ExpressionVisitor.VisitScalarExpression(topRowFilter.Expression); SqlServerTree.PutFragmentSpan(topRowFilterNode, topRowFilter); n.Limit.SetValue(topRowFilterNode); } if (offsetClause != null) { var offsetClauseNode = ExpressionVisitor.VisitScalarExpression(offsetClause.OffsetExpression); SqlServerTree.PutFragmentSpan(offsetClauseNode, offsetClause); n.Offset.SetValue(offsetClauseNode); } })); }
public override void Visit(OffsetClause node) { this.action(node); }
public override void ExplicitVisit(OffsetClause fragment) { _fragments.Add(fragment); }
public override void ExplicitVisit(OffsetClause node) { IsSuspected = false; base.ExplicitVisit(node); }