Adds limit and offset to SQL statement.

@param int $limit
@param int $offset
@return void
76
public function addLimitOffset(int $limit, int $offset): void
    {
        if ($limit === 0 && $offset === 0) {
            return;
        }
        if ($limit === 0 && $offset <> 0) {
            return;
        }
        if ($offset === 0) {
            $this->statement .= ' LIMIT ' . $limit;
        } else {
            $this->statement .= sprintf(' LIMIT %d, %d', $offset, $limit);
        }
        $this->statement .= PHP_EOL;
    }
1323296
public function limit( $new_limit ) {
		$this->limit = $new_limit;
		if ( false === starts_with( $new_limit . '', ':' ) ) {
			$this->limit = (int) $new_limit;
		}
	}
1353343
public function applyLimit(&$sql, $offset, $limit)
    {
        $offset = (int) $offset;
        $limit = (int) $limit;

        if ($limit >= 0) {
            $sql .= ' LIMIT ' . ($offset > 0 ? $offset . ', ' : '') . $limit;
        } elseif ($offset > 0) {
            $sql .= ' LIMIT ' . $offset . ', 18446744073709551615';
        }
    }
1029925
public function find($limit = 20, $offset = 0)
	{
		return $this->buildFind()
			->setLimit($limit)
			->setOffset($offset)
			->find();
	}
1032397
public function limit($offset, $limit)
	{
		$this->criteria->setFirstResult($offset)->setMaxResults($limit);

		return $this;
	}
105306
protected function offsetLimit()
    {
        if ($this->limit != 0 || $this->offset != 0)
            $this->documents = array_slice($this->documents, $this->offset, $this->limit);
    }
721174
public function limit($limit, $offset = null){
		if($this->validateConditions())
			return $this;

		$this->resetState();
		$this->limit = array($limit,
			($offset !== null && $this->type === Manager::STMT_SELECT) ? $offset : null);
		return $this;
	}
293846
private function build_limit( $limit, $offset ) {
		$sql = '';
		if ( isset( $limit ) && $limit > 0 ) {
			if ( isset( $offset ) && $offset > 0 ) {
				$sql .= " LIMIT {$offset}, {$limit}";
			} else {
				$sql .= " LIMIT {$limit}";
			}
		}

		return $sql;
	}
1197495
public function limit($limit, $offset = null)
    {
        $this->_limit = $limit > 0 ? (int)$limit : null;
        $this->_offset = $offset > 0 ? (int)$offset : null;

        return $this;
    }
267158
public function limit($offset = null, $limit = null)
    {
    	$args = func_get_args();
    	if (count($args) === 0) {
    		throw new Exception('At least 1 argument');
    	}
    	if (count($args) == 1) {
    		$this->limit =  $args[0];
    	} else {
    		list($this->offset, $this->limit) = $args;
    	}
        return $this;
    }
788384
public function limit($limit, $offset = null)
    {
        $this->queryBuilder->setLimit($limit, $offset);
        return $this;
    }
316247
public function formatLimitOffset($limit, $offset = 0) {
        if ($limit && $offset) {
            return sprintf($this->getClause(self::LIMIT_OFFSET), (int) $limit, (int) $offset);
        }

        return $this->formatLimit($limit);
    }
811987
protected function applyLimit(array $data, $limit, $offset)
    {
        if (empty($limit) && empty($offset)) {
            return $data;
        }

        if (!ctype_digit((string) $limit)) {
            $limit = null;
        }

        if (!ctype_digit((string) $offset)) {
            $offset = 0;
        }

        return array_slice($data, $offset, $limit);
    }
1160793
public function setLimits($offset, $limit, $max = 0, $cutoff = 0)
    {
        assert(is_int($offset));
        assert(is_int($limit));
        assert(is_int($max));
        assert(is_int($cutoff));
        assert($offset >= 0);
        assert($limit > 0);
        assert($max >= 0);
        assert($cutoff >= 0);

        $this->_offset = $offset;
        $this->_limit = $limit;
        if ($max > 0) {
            $this->_maxmatches = $max;
        }
        if ($cutoff > 0) {
            $this->_cutoff = $cutoff;
        }

        return $this;
    }
1221905
public function read($offset = null, $limit = 10)
    {
        if ($offset === null) {
            $offset = (((int) (($this->getLastRowId() - 1) / $limit)) * $limit) + 1;
        }

        $sql = 'SELECT * FROM ' . $this->table
            . ' WHERE id >= ?'
            . ' ORDER BY id ASC'
            . ' LIMIT ?';

        $events = [];

        $stmt = $this->connection->prepare($sql);
        $stmt->bindValue(1, $offset, Type::INTEGER);
        $stmt->bindValue(2, $limit, Type::INTEGER);
        $stmt->execute();

        while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
            $events[$row['id']] = $this->fromArray($row);
        }

        return $events;
    }
793499
public function limit($offset, $limit)
	{
		$sql = (string) $this->data_source;

		$result = $this->data_source->getConnection()
			->query('%sql OFFSET ? ROWS FETCH NEXT ? ROWS ONLY', $sql, $offset, $limit);

		$this->data = $result->fetchAll();

		return $this;
	}
1155268
public function applyLimit(&$sql, $offset, $limit, $criteria = null)
    {
        if (BasePeer::needsSelectAliases($criteria)) {
            $crit = clone $criteria;
            $selectSql = $this->createSelectSqlPart($crit, $params, true);
            $sql = $selectSql . substr($sql, strpos($sql, 'FROM') - 1);
        }
        $sql = 'SELECT B.* FROM ('
            . 'SELECT A.*, rownum AS PROPEL_ROWNUM FROM (' . $sql . ') A '
            . ') B WHERE ';

        if ($offset > 0) {
            $sql .= ' B.PROPEL_ROWNUM > ' . $offset;
            if ($limit > 0) {
                $sql .= ' AND B.PROPEL_ROWNUM <= ' . ($offset + $limit);
            }
        } else {
            $sql .= ' B.PROPEL_ROWNUM <= ' . $limit;
        }
    }