• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/location/connector.php
  • Класс: BitrixSaleLocationConnector
  • Вызов: Connector::queryPage
static function queryPage($sql, $limit = 0, $offset = 0)
{
	$artificialNav = false;
	$limit = intval($limit);
	$offset = intval($offset);

	// todo: Luke, use BitrixMainDBPaginator here

	$dbConnection = MainHttpApplication::getConnection();

	if($limit)
	{
		if($dbConnection->getType() == 'mysql')
		{
			$sql .= ' limit '.($offset ? $offset.', ' : '').$limit;
		}
		else
		{
			$artificialNav = true;
		}
	}

	$res = $dbConnection->query($sql);

	if($artificialNav)
	{
		$result = array();

		$i = -1;
		while($item = $res->fetch())
		{
			$i++;

			if($i < $offset)
				continue;

			if($i >= $offset + $limit)
				break;

			$result[] = $item;
		}

		return new DBArrayResult($result);
	}
	else
		return $res;
}