mirror of
https://github.com/dg/dibi.git
synced 2025-08-05 21:58:10 +02:00
DibiFluent::fetch() uses limit only when there is no LIMIT & OFFSET (fixes 20f2093
on MSSQL)
This commit is contained in:
@@ -317,13 +317,12 @@ class DibiFluent extends DibiObject implements IDataSource
|
|||||||
*/
|
*/
|
||||||
public function fetch()
|
public function fetch()
|
||||||
{
|
{
|
||||||
if ($this->command === 'SELECT' && !$this->clauses['LIMIT']) {
|
if ($this->command === 'SELECT' && !$this->clauses['LIMIT'] && !$this->clauses['OFFSET']) {
|
||||||
$result = $this->query($this->limit(1)->_export())->fetch();
|
return $this->query($this->_export(NULL, array('%lmt', 1)))->fetch();
|
||||||
$this->removeClause('LIMIT');
|
} else {
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
return $this->query($this->_export())->fetch();
|
return $this->query($this->_export())->fetch();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -332,13 +331,12 @@ class DibiFluent extends DibiObject implements IDataSource
|
|||||||
*/
|
*/
|
||||||
public function fetchSingle()
|
public function fetchSingle()
|
||||||
{
|
{
|
||||||
if ($this->command === 'SELECT' && !$this->clauses['LIMIT']) {
|
if ($this->command === 'SELECT' && !$this->clauses['LIMIT'] && !$this->clauses['OFFSET']) {
|
||||||
$result = $this->query($this->limit(1)->_export())->fetchSingle();
|
return $this->query($this->_export(NULL, array('%lmt', 1)))->fetchSingle();
|
||||||
$this->removeClause('LIMIT');
|
} else {
|
||||||
return $result;
|
|
||||||
}
|
|
||||||
return $this->query($this->_export())->fetchSingle();
|
return $this->query($this->_export())->fetchSingle();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Reference in New Issue
Block a user