Query for id ordered rows starting at the offset and returning no more
than the limit.

@param limit
chunk limit
@param offset
chunk query offset
@return result
@since 3.1.0
189034
public TResult queryForChunk(int limit, long offset) {
		return queryForChunk(table.getPkColumn().getName(), limit, offset);
	}
154595
@Override
  public QueryBuilder<V> increaseOffsetBy(Integer amount) {
    if (offset == null) {
      offset = 0;
    }
    this.offset += amount;
    return this;
  }
1067632
async def filter_by(cls, db, offset=None, limit=None, **kwargs):
        
        if limit and type(limit) is not int:
            raise InvalidQuery('If limit is supplied it must be an int')
        if offset and type(offset) is not int:
            raise InvalidQuery('If offset is supplied it must be an int')

        ids_to_iterate = await cls._get_ids_filter_by(db, **kwargs)
        if offset:
            # Using offset without order_by is pretty strange, but allowed
            if limit:
                ids_to_iterate = ids_to_iterate[offset:offset+limit]
            else:
                ids_to_iterate = ids_to_iterate[offset:]
        elif limit:
            ids_to_iterate = ids_to_iterate[:limit]

        for key in ids_to_iterate:
            yield await cls.load(db, key)
1147542
public List<WebhookDeliveryLiteDto> selectOrderedByCeTaskUuid(DbSession dbSession, String ceTaskUuid, int offset, int limit) {
    return mapper(dbSession).selectOrderedByCeTaskUuid(ceTaskUuid, new RowBounds(offset, limit));
  }
1365105
public static <E> Page<E> offsetPage(int offset, int limit, boolean count) {
        Page<E> page = new Page<E>(new int[]{offset, limit}, count);
        //当已经执行过orderBy的时候
        Page<E> oldPage = getLocalPage();
        if (oldPage != null && oldPage.isOrderByOnly()) {
            page.setOrderBy(oldPage.getOrderBy());
        }
        setLocalPage(page);
        return page;
    }
1081511
def fetch(self, limit, offset=0):
        """"""
        self.limit = limit
        self.offset = offset
        return self
1083424
public function findAll($limit = 0, $offset = 0)
    {
        $limit = $this->getLimit($limit, $offset);
        $query = 'SELECT ' . $this->getFields(", ") . '
                  FROM ' . $this->tableName . '
                  ' . $limit . ' ;';
        $statement = $this->database->prepare($query);
        $statement->execute();
        return $this->buildAll($statement->fetchAll());
    }
465682
private function appendLimitAndOffset(QueryBuilder $builder, $limit, $offset)
    {
        $limit = (int) $limit;
        $offset = (int) $offset;

        if ($limit > 0) {
            $builder->limit($limit);
        }

        if ($offset > 0) {
            $builder->skip($offset);
        }
        return $this;
    }
1242188
@Override
  public Collection<TriggerInstance> getRecentlyFinished(final int limit) {
    final String query = String.format(SELECT_RECENTLY_FINISHED, limit);
    try {
      return this.dbOperator
          .query(query, new TriggerInstanceHandler(SORT_MODE.SORT_ON_START_TIME_ASC));
    } catch (final SQLException ex) {
      handleSQLException(ex);
    }
    return Collections.emptyList();
  }
1247305
public TableOperation createLimitWithOffset(int offset, TableOperation child) {
		SortTableOperation previousSort = validateAndGetChildSort(child);

		if (offset < 0) {
			throw new ValidationException("Offset should be greater or equal 0");
		}

		if (previousSort.getOffset() != -1) {
			throw new ValidationException("OFFSET already defined");
		}

		return new SortTableOperation(previousSort.getOrder(), previousSort.getChild(), offset, -1);
	}
485245
function(limit, offset) {
    const self = this.chain()._unresolve() // if the collection is already resolved, return a unresolved and empty copy!

    offset = offset || self.getInternal('offset') || 0

    if (typeof limit === 'string') limit = parseInt(limit)
    if (typeof offset === 'string') offset = parseInt(offset)

    if (!isNaN(limit)) {
      self.setInternal('limit', limit)
      self.setInternal('no_relation_cache', true)
    }
    if (!isNaN(offset)) {
      self.setInternal('offset', offset)
      self.setInternal('no_relation_cache', true)
    }

    if (!limit) {
      self.clearInternal('offset', offset)
      self.clearInternal('limit', limit)
    }

    return self
  }
425891
public function limit(string $sql, int $limit, $offset=FALSE): string
	{
		$sql .= "\nLIMIT {$limit}";

		if (is_numeric($offset))
		{
			$sql .= " OFFSET {$offset}";
		}

		return $sql;
	}
396208
public function get($limit = null, $offset = null)
    {
        if (isset($limit)) {
            $this->limit($limit, $offset);
        }

        if (false !== ($result = $this->conn->query($this->builderCache))) {
            $result->setTotalRows($this->countAllResults(true));
        }

        $this->builderCache->reset();

        return $result;
    }
899541
protected function set_limit($query, $limit = 0, $offset = 0)
    {
        $limit  = intval($limit);
        $offset = intval($offset);
        $end    = $offset + $limit;

        // query without OFFSET
        if (!$offset) {
            $query = preg_replace('/^SELECT\s/i', "SELECT TOP $limit ", $query);
            return $query;
        }

        $orderby = stristr($query, 'ORDER BY');
        $offset += 1;

        if ($orderby !== false) {
            $query = trim(substr($query, 0, -1 * strlen($orderby)));
        }
        else {
            // it shouldn't happen, paging without sorting has not much sense
            // @FIXME: I don't know how to build paging query without ORDER BY
            $orderby = "ORDER BY 1";
        }

        $query = preg_replace('/^SELECT\s/i', '', $query);
        $query = "WITH paging AS (SELECT ROW_NUMBER() OVER ($orderby) AS [RowNumber], $query)"
            . " SELECT * FROM paging WHERE [RowNumber] BETWEEN $offset AND $end ORDER BY [RowNumber]";

        return $query;
    }
838127
private static long getNextPageOffset(final int offset, final int limit, final long total) {
        return hasFullNextPage(offset, limit, total) ? getNextFullPageOffset(offset, limit) : getLastPageOffset(total, limit);
    }
663912
private function fetchRangeIds($limit, $start)
    {
        $qb = $this->createFilterAndSortQueryBuilder();
        $qb->select(['t.id', 'e.latest_version']);

        if (null !== $limit) {
            $qb->setFirstResult($start);
            $qb->setMaxResults($limit);
        }

        $rows = $this->connection->fetchAll($qb->getSQL());

        $ids = [];
        foreach ($rows as $row) {
            $ids[$row['id']] = $row['latest_version'];
        }

        return $ids;
    }
219918
public function limit($limit, $offset = null)
    {
        if ($offset !== null) {
            $this->builder->setFirstResult((int) $offset);
        }

        $this->builder->setMaxResults((int) $limit);

        return $this;
    }