Exemplo n.º 1
0
        public virtual void WriteLimitExpressionParameter(
            LimitQueryExpression limitQueryExpression,
            QueryExpressionVisitor queryExpressionVisitor
            )
        {
            queryText.Append(" LIMIT ");
            WriteIfNotNull(limitQueryExpression.Limit, queryExpressionVisitor);

            if (limitQueryExpression.Offset != null)
            {
                queryText.Append(" OFFSET ");
                WriteIfNotNull(limitQueryExpression.Offset, queryExpressionVisitor);
            }
        }
Exemplo n.º 2
0
        public override void WriteLimitExpressionParameter(LimitQueryExpression limitQueryExpression, QueryExpressionVisitor queryExpressionVisitor)
        {
            var currentQuery = statementStack.Peek() as SelectStatementQueryExpression;

            if (currentQuery.OrderBy == null)
            {
                queryText.Append(" ORDER BY (SELECT NULL) ");
            }

            if (limitQueryExpression.Offset == null)
            {
                queryText.Append(" OFFSET 0 ROWS FETCH FIRST ");
            }
            else
            {
                queryText.Append(" OFFSET ");
                WriteIfNotNull(limitQueryExpression.Offset, queryExpressionVisitor);
                queryText.Append(" ROWS FETCH NEXT ");
            }

            WriteIfNotNull(limitQueryExpression.Limit, queryExpressionVisitor);
            queryText.Append(" ROWS ONLY ");
        }