prepare the limit

@access private
@return string
774677
private function _prepareLimit()
	{
		$sQuery = '';
		$limit = (int) $this->_iLimit;
		$iOffset = $this->_iOffset;

		if($limit != 0 || $iOffset > 0) { $sQuery .= ' LIMIT '; }

		if($iOffset > 0) { $sQuery .= $iOffset.', '.$limit; }
		else if($limit != 0) { $sQuery .= $limit.' '; }

		return $sQuery;
	}
486057
public function limit($limit)
    {
        if ($limit === null) {
            unset($this->parameters['Limit']);
        } else {
            $this->parameters['Limit'] = $limit;
        }

        return $this;
    }
378458
public function limit($limit)
    {
        $limit = (int)$limit;
        $limit < 1 && $limit = 1;
        return $this->add('limit', $limit);
    }
495276
public function setLimit($limit) {
        if (!is_numeric($limit)) {
            $limit = self::DEFAULT_LIMIT;
        }

        if (0 == $limit) {
            // Display ALL Results - No Limit!
            $limit = null;
        }

        $this->limit = $limit;

        return $this;
    }
857511
private function _prepare()
	{
		if (count($this->_aSelect) > 0 && $this->_aSelect[0] === 'FOUND_ROWS()' && $this->_sFrom === '') {

			$sQuery = 'SELECT FOUND_ROWS()';
		}
		else if (count($this->_aSelect) > 0 && $this->_sFrom !== '') {

			$sQuery = 'SELECT '.implode(',', $this->_aSelect).' FROM `'.$this->_sFrom.'` ';
			$sQuery = str_replace('SQL_CALC_FOUND_ROWS,', 'SQL_CALC_FOUND_ROWS ', $sQuery);

			if ($this->_sFromAs !== null) {

				$sQuery .= 'AS '.$this->_sFromAs.' ';
			}
			else {

				$sQuery .= 'AS t'.$this->_iAlias.' ';
				$this->_sFromAs = 't'.$this->_iAlias;
				$this->_iAlias++;
			}

			$sQuery .= $this->_prepareJoin();
			$sQuery .= $this->_prepareWhere();
			$sQuery .= $this->_prepareGroupBy();
			$sQuery .= $this->_prepareHaving();
			$sQuery .= $this->_prepareOrderBy();
			$sQuery .= $this->_prepareLimit();
		}
		else if ($this->_sUpdate !== '') {

			$sQuery = 'UPDATE `'.$this->_sUpdate.'` ';

			if (count($this->_aSet) > 0) {

				$sQuery .= ' SET ';

				foreach ($this->_aSet as $sKey => $sValue) {

					if ($sValue !== null) {

						$sQuery .= "`".$sKey."` = ".self::connect()->quote($sValue).",";
					}
				}
			}

			$sQuery = substr($sQuery, 0, -1);

			$sQuery .= $this->_prepareWhere();
		}
		else if ($this->_sInsertInto !== '') {

			$sQuery = 'INSERT INTO `'.$this->_sInsertInto.'` (';

			foreach ($this->_aValues as $sKey => $sValue) {

			    if (!is_array($sValue)) { $sQuery .= " `".$sKey."`,"; }
			}

			$sQuery = substr($sQuery, 0, -1);
			$sQuery .= ") VALUES (";

			foreach ($this->_aValues as $sKey => $sValue) {

				if (!is_array($sValue)) { $sQuery .= "".self::connect()->quote($sValue).","; }
			}

			$sQuery = substr($sQuery, 0, -1);
			$sQuery .= ")";
			
			if (count($this->_aOnDuplicateKeyUpdate) > 0) {
			    
			    $sQuery .= " ON DUPLICATE KEY UPDATE ";
			    
    			foreach ($this->_aOnDuplicateKeyUpdate as $sKey => $sValue) {
    			    
    			    $sQuery .= " ".$sKey." = ".self::connect()->quote($sValue).",";
    			}
    			
    			$sQuery = substr($sQuery, 0, -1);
			}
		}
		else if ($this->_sDelete !== '') {

			$sQuery = 'DELETE FROM `'.$this->_sDelete.'`';
			$sQuery .= $this->_prepareWhere();
		}
		else if ($this->_sTruncate !== '') {

			$sQuery = 'TRUNCATE `'.$this->_sTruncate.'`';
		}

		return $sQuery;
	}
1291815
protected function prepare_query() 
	{
		$this->query->where( $this->foreign_key, $this->local_model->{$this->local_key} )
			->limit( 1 );
	}
1021695
public function setLimit($limit)
    {
        if (!is_scalar($limit)) {
            $this->limit = self::DEFAULT_LIMIT;

            return $this;
        } else {
            $limit = (int)$limit;
        }

        if ($limit > self::MAX_LIMIT) {
            $this->limit = self::MAX_LIMIT;
        } elseif ($limit < 1) {
            $this->limit = self::DEFAULT_LIMIT;
        } else {
            $this->limit = $limit;
        }

        return $this;
    }
1284811
public function prepareLimit($limit, $offset = null)
    {
        if ($offset) {
            $this->setLimit = ' LIMIT ' . $limit . ', ' . $offset . '';
        } else {
            $this->setLimit = ' LIMIT ' . $limit . '';
        }

        return $this;
    }
699782
private function buildLimit() {
        $this->getCriteria()->limit($this->getIndexCriteria()->getLimit(), $this->getIndexCriteria()->getOffset());
    }
1354359
public function getMaxOpenFilesLimit()
    {
        static $limit = null;

        if (null === $limit) {
            $process = new Process('ulimit -n');
            $process->run();

            if ($process->isSuccessful()) {
                $limit = (int) trim($process->getOutput());
            }

            unset($process);
        }

        return $limit;
    }
566609
protected function limitPending()
    {
        $offset     = $this->pending['limit']['offset'];
        $num        = $this->pending['limit']['number'];
        $this->data = array_slice($this->data, $offset, $num);
    }
462733
protected function getLimitQuery( $limits = array() )
	{
		if( is_array( $limits ) && count( $limits ) == 2 )
			$limits	= ' LIMIT '.$limits[0].', '.$limits[1];
		else if( is_int( $limits ) && $limits )
			$limits	= ' LIMIT 0, '.$limits;
		else
			$limits	= '';
		return $limits;
	}
678593
protected function pushLimit()
    {
        if( null !== $this->limit ) {
            if( null !== $this->offset ) {
                $this->parts[] = 'LIMIT ?, ?';
                $this->params[] = $this->offset;
                $this->params[] = $this->limit;
            } else {
                $this->parts[] = 'LIMIT ?';
                $this->params[] = $this->limit;
            }
        }
    }
40584
def clean_limit(self):
        ""
        limit = self.cleaned_data.get('limit', None)
        if (settings.SELECTABLE_MAX_LIMIT is not None and
            (not limit or limit > settings.SELECTABLE_MAX_LIMIT)):
            limit = settings.SELECTABLE_MAX_LIMIT
        return limit
269245
public function limit() 
    {
        $url = self::HOST . self::LIMIT;

        $params = $this->get_default_params();
        $result = $this->request($url, $params);
        $result = explode("\n", $result);

        return array(
            'code' => $result[0],
            'total' => $result[1],
            'current' => $result[2]
        );
    }
1022465
public static function limit($params) {
        $limit = $params['args'][0];
        $ormObject = !is_null($params['ormObject']) ? $params['ormObject'] : ORM::for_table($params['table']);
        
        return $ormObject->limit($limit);
    }
292421
public function buildLimit()
	{
		$string  = 'LIMIT ';
		$string .= ((!empty($this->start)) ? (int)$this->start . ',' : '');
		$string .= ((!empty($this->limit)) ? (int)$this->limit : '18446744073709551615');

		return $string;
	}