Compile the LIMIT clause.

@return string
12658
public function sqlPagination()
    {
        $pager = $this->pagination();
        if (!$pager instanceof DatabasePagination) {
            $pager = $this->createPagination($pager->data());
        }

        $sql = $pager->sql();
        if (strlen($sql) > 0) {
            $sql = ' '.$sql;
        }

        return $sql;
    }
390423
def compile(self, expr, params=None, limit=None):
        
        query_ast = self._build_ast_ensure_limit(expr, limit, params=params)
        return query_ast.compile()
1047906
public function getLimit()
    {
        if ($this->offset && $this->limit) {
            return $this->offset . ',' . $this->limit;
        }

        return (string)$this->limit;
    }
230684
protected function getOrderLimitSql() {

		$router = Router::getInstance();
		
		$ret = '';
		
		if ($router->order) {
			$orderOptions = $this->getOrderOptions();
			if (isset($orderOptions[$router->order])) { 
				$ret = ' ORDER BY ' . $orderOptions[$router->order];
			}
		}

		$ret .= ' LIMIT ' . $this->pagination->start . ', ' . $this->pagination->limit;
		
		return $ret;
		
	}
942386
public function build(): string
    {
        $sql = [];
        $sql = $this->getUpdateSql($sql);
        $sql = $this->getSetSql($sql);
        $sql = $this->condition->getWhereSql($sql);
        $sql = $this->getOrderBySql($sql);
        $sql = $this->getLimitSql($sql);
        $result = trim(implode(' ', $sql)) . ';';

        return $result;
    }
1263577
public function bindLimit()
    {
        if ($this->limit !== null) {            
            $this->sqlQuery->bindValue($this->positioningMarker, $this->limit, PDO::PARAM_INT);
            $this->positioningMarker++;
            $this->sqlQuery->bindValue($this->positioningMarker, $this->offset, PDO::PARAM_INT);
        }

        return $this;
    }
280742
private function buildQuery()
    {
        $this->validateQuery();

        $statement = "";
        if ($this->select !== null) {
            $statement .= sprintf("%s %s ", self::SELECT, $this->select);
        }
        if ($this->from !== null) {
            $statement .= sprintf("%s %s ", self::FROM, $this->from);
        }
        if ($this->where !== null) {
            $statement .= sprintf("%s %s ", self::WHERE, $this->where);
        }
        if ($this->orderBy !== null) {
            $statement .= sprintf("%s %s ", self::ORDER_BY, $this->orderBy);
        }
        if ($this->limit !== null) {
            $statement .= sprintf("%s %s ", self::LIMIT, $this->limit);
        }
        if ($this->offset !== null) {
            $statement .= sprintf("%s %s ", self::OFFSET, $this->offset);
        }

        return trim($statement);
    }
1183640
protected function buildLimit(
        /*# string */ $prefix,
        array $settings
    )/*# : string */ {
        $result = [];
        $clause = &$this->getClause('LIMIT');
        if (!empty($clause)) {
            $res = [];
            if ($clause[0]) {
                $res[] = $clause[0];
            }
            if ($clause[1]) {
                $res[] = 'OFFSET ' . $clause[1];
            }
            $result[] = join(' ', $res);
        }
        return $this->joinClause($prefix, ' ', $result, $settings);
    }
940640
private function getUpdateQuery()
	{
		$result = $this->getUpdateClause();

		if ($where = $this->getWhereClause()) {
			$result .= ' ' . $where;
		}

		if ($limit = $this->getLimitClause()) {
			$result .= ' ' . $limit;
		}

		return $result;
	}
211147
protected function compileUnions(Builder $query)
    {
        $sql = '';

        foreach ($query->unions as $union) {
            $sql .= $this->compileUnion($union);
        }

        if (! empty($query->unionOrders)) {
            $sql .= ' '.$this->compileOrders($query, $query->unionOrders);
        }

        if (isset($query->unionLimit)) {
            $sql .= ' '.$this->compileLimit($query, $query->unionLimit);
        }

        if (isset($query->unionOffset)) {
            $sql .= ' '.$this->compileOffset($query, $query->unionOffset);
        }

        return ltrim($sql);
    }
408633
public function ___build(): string
    {
        $tables = \implode(', ', $this->from);
        $where = $limit = '';

        if ($this->where !== '') {
            $where = \sprintf(' WHERE %s', $this->where);
        }
        if ($this->limit !== 0) {
            $limit = \sprintf(' LIMIT %s', $this->limit);
        }

        return \sprintf('DELETE FROM %s%s%s', $tables, $where, $limit);
    }
860564
public function getLimit()
    {
        if ($this->max > 0) {
            return min($this->max, $this->limit);
        }

        return $this->limit;
    }
425135
protected function parseUpdateStmt(){
		$sql = parent::parseUpdateStmt();
		if($this->driverName === 'mysql')
			return $this->applyLimit($sql . $this->clauses[3]);
		return $sql;
	}
155985
protected function _setLimit()
    {
        if (
            is_null($this->_sql->getLimit()) ||
            intval($this->_sql->getLimit()) < 1
        ) {
            return $this;
        }

        if ($this->_sql->getOffset() > 0) {
            return $this->_setLimitWithOffset();
        }
        return  $this->_setSimpleLimit();
    }
251944
protected function buildLimitOffset()
    {
        if (empty($this->limitOffset)) {
            return '';
        }

        $limitOffset = '';
        if ($this->limitOffset['limit'] && $this->limitOffset['offset']) {
            $limitOffset = $this->limitOffset['offset'] . ',' . $this->limitOffset['limit'];
        } elseif ($this->limitOffset['limit']) {
            $limitOffset = $this->limitOffset['limit'];
        } elseif ($this->limitOffset['offset']) {
            $limitOffset = $this->limitOffset['offset'];
        }

        return 'LIMIT ' . $limitOffset;
    }
401255
public function build()
    {
        $sql = [
            $this->from->build(),
            $this->where->build(),
            $this->orderBy->build(),
            $this->limit->build(),
        ];

        $this->values = $this->where->getValues();

        return implode(' ', array_filter($sql));
    }
989685
private function getCompileFunction()
    {
        switch (strtolower($this->sqlOperation)) {
            case self::QUERY_TYPE_INSERT:
                return 'compileInsert';
                break;

            case 'insertgetid':
                return 'compileInsertGetId';
                break;

            case self::QUERY_TYPE_UPDATE:
                return 'compileUpdate';
                break;

            case self::QUERY_TYPE_DELETE:
                return 'compileDelete';
                break;

            case self::QUERY_TYPE_TRUNCATE:
                return 'compileTruncate';
                break;

            default:
                return 'compileSelect';
                break;
        }
    }